Difference between revisions of "Terraform"
Jump to navigation
Jump to search
↑ https://www.terraform.io/docs/commands/index.html
Line 32: | Line 32: | ||
== Common Terraform commands<ref>https://www.terraform.io/docs/commands/index.html</ref> == | == Common Terraform commands<ref>https://www.terraform.io/docs/commands/index.html</ref> == | ||
+ | |||
+ | Main commands: | ||
+ | init Prepare your working directory for other commands | ||
+ | validate Check whether the configuration is valid | ||
+ | plan Show changes required by the current configuration | ||
+ | apply Create or update infrastructure | ||
+ | destroy Destroy previously-created infrastructure | ||
+ | |||
+ | All other commands: | ||
+ | console Try Terraform expressions at an interactive command prompt | ||
+ | fmt Reformat your configuration in the standard style | ||
+ | force-unlock Release a stuck lock on the current workspace | ||
+ | get Install or upgrade remote Terraform modules | ||
+ | graph Generate a Graphviz graph of the steps in an operation | ||
+ | import Associate existing infrastructure with a Terraform resource | ||
+ | login Obtain and save credentials for a remote host | ||
+ | logout Remove locally-stored credentials for a remote host | ||
+ | output Show output values from your root module | ||
+ | providers Show the providers required for this configuration | ||
+ | refresh Update the state to match remote systems | ||
+ | show Show the current state or a saved plan | ||
+ | state Advanced state management | ||
+ | taint Mark a resource instance as not fully functional | ||
+ | untaint Remove the 'tainted' state from a resource instance | ||
+ | version Show the current Terraform version | ||
+ | workspace Workspace management | ||
+ | |||
+ | Global options (use these before the subcommand, if any): | ||
+ | -chdir=DIR Switch to a different working directory before executing the | ||
+ | given subcommand. | ||
+ | -help Show this help output, or the help for a specified subcommand. | ||
+ | -version An alias for the "version" subcommand. | ||
+ | |||
+ | |||
+ | |||
+ | Older versions: | ||
[[terraform apply|apply]] Builds or changes infrastructure | [[terraform apply|apply]] Builds or changes infrastructure | ||
console Interactive console for Terraform interpolations | console Interactive console for Terraform interpolations |
Revision as of 08:40, 16 March 2021
wikipedia:Terraform (software) (2014) is an open-source infrastructure as code software.
- Terraform Cloud (September 2019)
- Terraform Enterprise
- Terraform Registry
Contents
Technical characteristics
- HCL2 based
- Types: strings, number, bool, list, maps, set, tuple, object, any and null (Terraform 0.12)
Supported platforms/providers
- AWS: AWS EKS, GCP, IBM Cloud, DigitalOcean, Azure: Azure Stack, AzureRM, OpenStack, ServiceNow, F5 Networks, Nutanix, Tecent Cloud, Helm, Oracle OCI, Brightbox, RightScale, Linode, SkyTap, UCloud, Hedvig, Zabbix
Installation
- macOS:
brew install terraform
. - Ubuntu:
snap install terraform
orsnap install terraform-snap
Terraform commands
terraform init
terraform plan
terraform apply
terraform remote config
terraform destroy
terraform fmt
terraform fmt -check
terraform show
terraform validate
terraform login
Common Terraform commands[1]
Main commands: init Prepare your working directory for other commands validate Check whether the configuration is valid plan Show changes required by the current configuration apply Create or update infrastructure destroy Destroy previously-created infrastructure All other commands: console Try Terraform expressions at an interactive command prompt fmt Reformat your configuration in the standard style force-unlock Release a stuck lock on the current workspace get Install or upgrade remote Terraform modules graph Generate a Graphviz graph of the steps in an operation import Associate existing infrastructure with a Terraform resource login Obtain and save credentials for a remote host logout Remove locally-stored credentials for a remote host output Show output values from your root module providers Show the providers required for this configuration refresh Update the state to match remote systems show Show the current state or a saved plan state Advanced state management taint Mark a resource instance as not fully functional untaint Remove the 'tainted' state from a resource instance version Show the current Terraform version workspace Workspace management
Global options (use these before the subcommand, if any):
-chdir=DIR Switch to a different working directory before executing the given subcommand. -help Show this help output, or the help for a specified subcommand. -version An alias for the "version" subcommand.
Older versions:
apply Builds or changes infrastructure console Interactive console for Terraform interpolations destroy Destroy Terraform-managed infrastructure fmt Rewrites config files to canonical format get Download and install modules for the configuration graph Create a visual graph of Terraform resources import Import existing infrastructure into Terraform init Initialize a new or existing Terraform configuration output Read an output from a state file plan Generate and show an execution plan providers Prints a tree of the providers used in the configuration push Upload this Terraform module to Terraform Enterprise to run refresh Update local state file against real resources show Inspect Terraform state or plan taint Manually mark a resource for recreation untaint Manually unmark a resource as tainted validate Validates the Terraform files version Prints the Terraform version workspace Workspace management All other commands: 0.12upgrade Rewrites pre-0.12 module source code for v0.12 0.13upgrade Rewrites pre-0.13 module source code for v0.13 debug Debug output management (experimental) force-unlock Manually unlock the terraform state push Obsolete command for Terraform Enterprise legacy (v1) state Advanced state management
Activities
- Read Terraform blog: https://www.hashicorp.com/blog/category/terraform/
- Read Terraform: Up & Running, 2nd edition Early Release is now available! https://blog.gruntwork.io/terraform-up-running-2nd-edition-early-release-is-now-available-b104fc29783f
- Terraform: Hello_world.tf
- Terraform, read files
Related
- HCL, HCL2
terraform_remote_state
count
parameter for iterations- Remote state backends to manage Terraform state
- Terragrunt
- Releases: https://github.com/hashicorp/terraform/releases
- Terraform libvirt provider
- Heredocs
See also
- Terraform, OpenTofu, Terrakube.org, Installation, Terraform AWS, Terraform GCP, Terraform commands, Terraform Cloud, Terraform Enterprise (TFE), HCL, HIL, meta-arguments, providers, modules, resource, provisioners, data sources, backends: remote backends, examples, configuration files, state files, variables, types, Terraform Registry, conditionals:
depends_on
, functions, Blocks, dynamic blocks, errors, Terragrunt, Terraformer, Terratest, Terraform certifications, Terraform map type, Terraform Associate, Terraform: list type,TF_VAR_, TF_LOG
, Terraform provider versioning, Terraform Style Conventions, Required version, Terraform plugin, Terraform Named Values, tags, Changelog,tfsec, tflint
, Operators, Expressions:for, splat
, Debugging, Namespaces, Terraform Landing Zones, CDKTF, Atmos - IaC: Terraform, Chef, cdist, capistrano, Harrow, puppet, Ansible, CFEngine, Cloud Deployment Manager, pulumi, juju, SaltStack, Azure Resource Manager (ARM), Google Deployment Manager, AWS CloudFormation, Pulumi, Heat, Spacelift, Oracle Cloud Resource Manager, KICS, Troposphere, CaC, IaC scanning
- Cloud: cloud providers, cloud timeline, serverless computing, AWS, Azure, Google Cloud, DigitalOcean, IBM Cloud, Alibaba CloudAlibaba, Tencent, Baidu, VPC, Cloud Foundry, Snowflake, Huawei Cloud, Oracle Cloud, CISPE, CIPS, Free trial, Cloudera, Vantage.sh, Render
Advertising: