run-terraform
Automatically generated README for this automation recipe: run-terraform
Category: Cloud automation
License: Apache 2.0
- Notes from the authors, contributors and users: README-extra
Setup for Google Cloud Instances
sudo snap install google-cloud-cli --classic
gcloud auth application-default login
The above two commands will install google-cloud-cli and authorizes the user to access it. Once done, you can start creating gcp instance using CM commands like below. To destroy an instance just repeat the same command with --destroy
option.
cm run script --tags=run,terraform,_gcp,_gcp_project.mlperf-inference-tests --cminit
mlperf-inference-tests
is the name of the google project as created in Google cloud console
- CM meta description for this script: _cm.json
- Output cached? True
Reuse this script in your project
Install MLCommons CM automation meta-framework
Pull CM repository with this automation recipe (CM script)
cm pull repo mlcommons@cm4mlops
Print CM help from the command line
cmr "run terraform" --help
Run this script
Run this script via CLI
cm run script --tags=run,terraform[,variations] [--input_flags]
Run this script via CLI (alternative)
cmr "run terraform [variations]" [--input_flags]
Run this script from Python
import cmind
r = cmind.access({'action':'run'
'automation':'script',
'tags':'run,terraform'
'out':'con',
...
(other input keys for this script)
...
})
if r['return']>0:
print (r['error'])
Run this script via Docker (beta)
cm docker script "run terraform[variations]" [--input_flags]
Variations
-
No group (any combination of variations can be selected)
Click here to expand this section.
_amazon-linux-2-kernel.#
- ENV variables:
- TF_VAR_INSTANCE_IMAGE_OS:
amazon-linux-2-kernel.#
- TF_VAR_INSTANCE_IMAGE_OS:
- ENV variables:
_graviton
- ENV variables:
- CM_TERRAFORM_AWS_GRAVITON_INSTANCE:
yes
- CM_TERRAFORM_AWS_GRAVITON_INSTANCE:
- ENV variables:
_inferentia
- ENV variables:
- CM_TERRAFORM_AWS_INFERENTIA_INSTANCE:
yes
- CM_TERRAFORM_AWS_INFERENTIA_INSTANCE:
- ENV variables:
_rhel.#
- ENV variables:
- TF_VAR_INSTANCE_IMAGE_OS:
rhel.#
- TF_VAR_INSTANCE_IMAGE_OS:
- ENV variables:
_ubuntu.#
- ENV variables:
- TF_VAR_INSTANCE_IMAGE_OS:
ubuntu.#
- TF_VAR_INSTANCE_IMAGE_OS:
- ENV variables:
-
Group "aws-instance-image"
Click here to expand this section.
_amazon-linux-2-kernel.510,arm64,us-west-2
- ENV variables:
- TF_VAR_INSTANCE_IMAGE:
ami-0f1a5f5ada0e7da53
- TF_VAR_INSTANCE_IMAGE:
- ENV variables:
_aws_instance_image.#
- ENV variables:
- TF_VAR_INSTANCE_IMAGE:
#
- TF_VAR_INSTANCE_IMAGE:
- ENV variables:
_aws_instance_image.ami-0735c191cf914754d
- ENV variables:
- TF_VAR_INSTANCE_IMAGE:
ami-0735c191cf914754d
- TF_VAR_INSTANCE_IMAGE:
- ENV variables:
_aws_instance_image.ami-0a0d8589b597d65b3
- ENV variables:
- TF_VAR_INSTANCE_IMAGE:
ami-0a0d8589b597d65b3
- TF_VAR_INSTANCE_IMAGE:
- ENV variables:
_rhel.9,x86,us-west-2
- ENV variables:
- TF_VAR_INSTANCE_IMAGE:
ami-0dda7e535b65b6469
- TF_VAR_INSTANCE_IMAGE:
- ENV variables:
_ubuntu.2204,arm64,us-west-2
- ENV variables:
- TF_VAR_INSTANCE_IMAGE:
ami-079f51a7bcca65b92
- TF_VAR_INSTANCE_IMAGE:
- ENV variables:
_ubuntu.2204,x86,us-west-2
- ENV variables:
- TF_VAR_INSTANCE_IMAGE:
ami-0735c191cf914754d
- TF_VAR_INSTANCE_IMAGE:
- ENV variables:
-
Group "aws-instance-type"
Click here to expand this section.
_a1.2xlarge
- ENV variables:
- TF_VAR_INSTANCE_TYPE:
a1.2xlarge
- TF_VAR_INSTANCE_TYPE:
- ENV variables:
_a1.metal
- ENV variables:
- TF_VAR_INSTANCE_TYPE:
a1.metal
- TF_VAR_INSTANCE_TYPE:
- ENV variables:
_a1.xlarge
- ENV variables:
- TF_VAR_INSTANCE_TYPE:
a1.xlarge
- TF_VAR_INSTANCE_TYPE:
- ENV variables:
_aws_instance_type.#
- ENV variables:
- TF_VAR_INSTANCE_TYPE:
#
- TF_VAR_INSTANCE_TYPE:
- ENV variables:
_c5.12xlarge
- ENV variables:
- TF_VAR_INSTANCE_TYPE:
c5.12xlarge
- TF_VAR_INSTANCE_TYPE:
- ENV variables:
_c5.4xlarge
- ENV variables:
- TF_VAR_INSTANCE_TYPE:
c5.4xlarge
- TF_VAR_INSTANCE_TYPE:
- ENV variables:
_c5d.9xlarge
- ENV variables:
- TF_VAR_INSTANCE_TYPE:
c5d.9xlarge
- TF_VAR_INSTANCE_TYPE:
- ENV variables:
_g4dn.xlarge
- ENV variables:
- TF_VAR_INSTANCE_TYPE:
g4dn.xlarge
- TF_VAR_INSTANCE_TYPE:
- ENV variables:
_inf1.2xlarge
- ENV variables:
- TF_VAR_INSTANCE_TYPE:
inf1.2xlarge
- TF_VAR_INSTANCE_TYPE:
- ENV variables:
_inf1.xlarge
- ENV variables:
- TF_VAR_INSTANCE_TYPE:
inf1.xlarge
- TF_VAR_INSTANCE_TYPE:
- ENV variables:
_inf2.8xlarge
- ENV variables:
- TF_VAR_INSTANCE_TYPE:
inf2.8xlarge
- TF_VAR_INSTANCE_TYPE:
- ENV variables:
_inf2.xlarge
- ENV variables:
- TF_VAR_INSTANCE_TYPE:
inf2.xlarge
- TF_VAR_INSTANCE_TYPE:
- ENV variables:
_m7g.2xlarge
- ENV variables:
- TF_VAR_INSTANCE_TYPE:
m7g.2xlarge
- TF_VAR_INSTANCE_TYPE:
- ENV variables:
_m7g.xlarge
- ENV variables:
- TF_VAR_INSTANCE_TYPE:
m7g.xlarge
- TF_VAR_INSTANCE_TYPE:
- ENV variables:
_t2.#
- ENV variables:
- TF_VAR_INSTANCE_TYPE:
t2.#
- TF_VAR_INSTANCE_TYPE:
- ENV variables:
_t2.2xlarge
- ENV variables:
- TF_VAR_INSTANCE_TYPE:
t2.2xlarge
- TF_VAR_INSTANCE_TYPE:
- ENV variables:
_t2.large
- ENV variables:
- TF_VAR_INSTANCE_TYPE:
t2.large
- TF_VAR_INSTANCE_TYPE:
- ENV variables:
_t2.medium
- ENV variables:
- TF_VAR_INSTANCE_TYPE:
t2.medium
- TF_VAR_INSTANCE_TYPE:
- ENV variables:
_t2.micro
- ENV variables:
- TF_VAR_INSTANCE_TYPE:
t2.micro
- TF_VAR_INSTANCE_TYPE:
- ENV variables:
_t2.nano
- ENV variables:
- TF_VAR_INSTANCE_TYPE:
t2.nano
- TF_VAR_INSTANCE_TYPE:
- ENV variables:
_t2.small
- ENV variables:
- TF_VAR_INSTANCE_TYPE:
t2.small
- TF_VAR_INSTANCE_TYPE:
- ENV variables:
_t2.xlarge
- ENV variables:
- TF_VAR_INSTANCE_TYPE:
t2.xlarge
- TF_VAR_INSTANCE_TYPE:
- ENV variables:
-
Group "cloud-provider"
Click here to expand this section.
_aws
(default)- ENV variables:
- CM_TERRAFORM_CONFIG_DIR_NAME:
aws
- CM_TERRAFORM_CONFIG_DIR_NAME:
- ENV variables:
_gcp
- ENV variables:
- CM_TERRAFORM_CONFIG_DIR_NAME:
gcp
- CM_TERRAFORM_CONFIG_DIR_NAME:
- ENV variables:
-
Group "gcp-instance-image"
Click here to expand this section.
_debian-cloud/debian-11
- ENV variables:
- TF_VAR_INSTANCE_IMAGE:
debian-cloud/debian-11
- TF_VAR_INSTANCE_IMAGE:
- ENV variables:
_gcp_instance_image.#
- ENV variables:
- TF_VAR_INSTANCE_IMAGE:
#
- TF_VAR_INSTANCE_IMAGE:
- ENV variables:
_ubuntu-2204-jammy-v20230114
- ENV variables:
- TF_VAR_INSTANCE_IMAGE:
ubuntu-2204-jammy-v20230114
- TF_VAR_INSTANCE_IMAGE:
- ENV variables:
-
Group "gcp-instance-type"
Click here to expand this section.
_f1-micro
- ENV variables:
- TF_VAR_INSTANCE_TYPE:
f1-micro
- TF_VAR_INSTANCE_TYPE:
- ENV variables:
_gcp_instance_type.#
- ENV variables:
- TF_VAR_INSTANCE_TYPE:
#
- TF_VAR_INSTANCE_TYPE:
- ENV variables:
_n1-highmem.#
- ENV variables:
- TF_VAR_INSTANCE_TYPE:
n1-highmem-#
- TF_VAR_INSTANCE_TYPE:
- ENV variables:
_n1-standard.#
- ENV variables:
- TF_VAR_INSTANCE_TYPE:
n1-highmem-#
- TF_VAR_INSTANCE_TYPE:
- ENV variables:
-
Group "gcp-project"
Click here to expand this section.
_gcp_project.#
- ENV variables:
- TF_VAR_GCP_PROJECT:
#
- TF_VAR_GCP_PROJECT:
- ENV variables:
-
Group "instance-name"
Click here to expand this section.
_instance_name.#
- ENV variables:
- TF_VAR_INSTANCE_NAME:
#
- TF_VAR_INSTANCE_NAME:
- ENV variables:
-
Group "platform"
Click here to expand this section.
_arm64
- ENV variables:
- CM_INSTANCE_PLATFORM:
arm64
- CM_INSTANCE_PLATFORM:
- ENV variables:
_x86
(default)- ENV variables:
- CM_INSTANCE_PLATFORM:
x86
- CM_INSTANCE_PLATFORM:
- ENV variables:
-
Group "region"
Click here to expand this section.
_region.#
- ENV variables:
- TF_VAR_INSTANCE_REGION:
#
- TF_VAR_INSTANCE_REGION:
- ENV variables:
_us-west-2
- ENV variables:
- TF_VAR_INSTANCE_REGION:
us-west-2
- TF_VAR_INSTANCE_REGION:
- ENV variables:
-
Group "storage-size"
Click here to expand this section.
_storage_size.#
- ENV variables:
- TF_VAR_DISK_GBS:
#
- TF_VAR_DISK_GBS:
- ENV variables:
_storage_size.8
- ENV variables:
- TF_VAR_DISK_GBS:
8
- TF_VAR_DISK_GBS:
- ENV variables:
-
Group "zone"
Click here to expand this section.
_zone.#
- ENV variables:
- TF_VAR_INSTANCE_ZONE:
#
- TF_VAR_INSTANCE_ZONE:
- ENV variables:
Default variations
_aws,_x86
Script flags mapped to environment
--cminit=value
→CM_TERRAFORM_CM_INIT=value
--destroy=value
→CM_DESTROY_TERRAFORM=value
--gcp_credentials_json_file=value
→CM_GCP_CREDENTIALS_JSON_PATH=value
--key_file=value
→CM_SSH_KEY_FILE=value
--run_cmds=value
→CM_TERRAFORM_RUN_COMMANDS=value
--ssh_key_file=value
→CM_SSH_KEY_FILE=value
Default environment
These keys can be updated via --env.KEY=VALUE
or env
dictionary in @input.json
or using script flags.
- TF_VAR_SECURITY_GROUP_ID:
sg-0783752c97d2e011d
- TF_VAR_CPU_COUNT:
1
Native script being run
No run file exists for Windows
Script output
cmr "run terraform [variations]" [--input_flags] -j