![]() ![]() target option allows to destroy only one resource, for example, an S3 bucket : $ terraform destroy -target aws_s3_bucket.my_bucket This -target option works with Terraform plan too. $ terraform apply -auto-approve Apply and Define New Variables Value $ terraform apply -auto-approve -var tags-repository_url=$Īpply Only One Module $ terraform apply -target=module.s3 This reduces the risk of potentially-sensitive data being left behind, or accidentally checked into version control. Good to know: Since Terraform v0.11+, in an interactive mode (non CI/CD/autonomous pipeline), you can just execute terraform apply command which will print out which actions TF will perform.īy generating the plan and applying it in the same command, Terraform can guarantee that the execution plan won’t change, without needing to write it to disk. Now you have the desired state so you can execute the plan. When you execute terraform plan, Terraform will scan all *.tf files in your directory and create the plan. It’s an important feature of Terraform that allows a user to see which actions Terraform will perform prior to making any changes, increasing confidence that a change will have the desired effect once applied. The plan step check configuration to execute and write a plan to apply to target infrastructure provider. Once you do that, unless you do another terraform get -update=true, you’ve essentially vendored those modules. ![]() When you use modules, the first thing you’ll have to do is to do a terraform get. Modules are vendored, so when you edit them, you need to get again modules content. This command is useful when you have defined some modules. reconfigure is used in order to tell Terraform to not copy the existing state to the new remote state location. $ terraform init -backend-config=cfg/s3.dev.tf -reconfigure ![]() $ terraform init -input=false Change Backend Configuration During the Init The command terraform init will install : Unless terraform plan, apply, destroy and import will not work. It’s the first command you need to execute. Then, you can install the desired version of Terraform: $ tfenv install 0.11.10 Usage Show Version $ terraform -version $ echo 'export PATH="$HOME/.tfenv/bin:$PATH"' > $HOME/bashrc or Install Through tfenv, a Terraform Version Managerįirst of all, download the tfenv binary and put it in your PATH. $ sudo unzip terraform_0.11.10_linux_amd64.zip -d /usr/local/bin/ Installation Install Through curl $ curl -O This tool has a powerful and very intuitive Command Line Interface. Terraform, a tool created by Hashicorp in 2014, written in Go, aims to build, change and version control your infrastructure. You might also enjoy Linode's Beginner's Guide to Terraform. When we want to use a tool or improve our expertise in a particular technology, it's good to read a lot of articles and, of course, to manipulate the technology.īut sometimes, it can be useful to have a simple cheat sheet of the tool. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |