Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

Terraform builds an execution plan that only modifies what is necessary to reach your desired state.

Sumit Rawal answered on May 14, 2023 Popularity 1/10 Helpfulness 1/10

Contents


More Related Answers

  • aws instance creation using terraform
  • terraform state
  • Terraform to upgrade modules and plugins
  • 7. What are the advantages of Terraform?
  • how many ways you can create the varible in terraform
  • at least 1 features blocks are required. terraform
  • Understand basic Terraform Commands
  • terraform apply force recreate
  • 19. How do you manually install terraform?
  • what is terraform plan
  • Terraform project example#
  • gcp terraform module project factory
  • 9. How can Terraform build infrastructure so efficiently?
  • 15. What is the Terraform State?
  • 16. What is the purpose of the Terraform State?
  • 20. Where do you put terraform configurations so that you can configure some behaviors of Terraform itself?
  • 60. When terraform mark the resources are tainted?
  • 61. You applied the infrastructure with terraform apply and you have some tainted resources. You run an execution plan now what happens to those tainted resources?
  • 66. By default, provisioners that fail will also cause the Terraform apply itself to fail. How do you change this?
  • 71. When does the terraform does not recommend using provisions?
  • 81. What is the recommended approach after upgrading terraform?
  • 118. Your team has decided to use terraform in your company and you have existing infrastructure. How do you migrate your existing resources to terraform and start using it?
  • 131. What is a Terraform Module?
  • 158. When you are doing initialization with terraform init, you want to skip child module installation. What should you do?
  • 160. When you are doing initialization with terraform init, you want to skip plugin installation. What should you do?
  • 173. How do you target only specific resources when you run a terraform plan?
  • 174. How do you update the state prior to checking differences when you run a terraform plan?
  • 240. Terraform workspaces when you are working with CLI and Terraform workspaces in the Terraform cloud. Is this correct?
  • 8. If you wanted to build a pipeline to run terraform deployments of infrastructure, what are a couple of options you can utilize to do that?
  • Building your Terraform project with sam build

  • Terraform builds an execution plan that only modifies what is necessary to reach your desired state.

    0

    By using Terraform to change infrastructure, you can version control not only your configurations but also your state so you can see how the infrastructure evolved over time.

    Let’s modify the ami of our instance. Edit the aws_instance.example resource in your configuration and change it to the following:

    resource “aws_instance” “example” {

    ami = “ami-b374d5a5”

    instance_type = “t2.micro”

    }

    $ terraform apply

    # …

    -/+ aws_instance.example

    ami: “ami-2757f631” => “ami-b374d5a5” (forces new resource)

    availability_zone: “us-east-1a” => “

    ebs_block_device.#: “0” => “

    ephemeral_block_device.#: “0” => “

    instance_state: “running” => “

    instance_type: “t2.micro” => “t2.micro”

    private_dns: “ip-172–31–17–94.ec2.internal” => “

    private_ip: “172.31.17.94” => “

    public_dns: “ec2–54–82–183–4.compute-1.amazonaws.com” => “

    public_ip: “54.82.183.4” => “

    subnet_id: “subnet-1497024d” => “

    vpc_security_group_ids.#: “1” => “

    The prefix -/+ means that Terraform will destroy and recreate the resource, rather than updating it in-place. While some attributes can be updated in-place (which are shown with the ~ prefix), changing the AMI for an EC2 instance requires recreating it. Terraform handles these details for you, and the execution plan makes it clear what Terraform will do.

    Additionally, the execution plan shows that the AMI change is what required resource to be replaced. Using this information, you can adjust your changes to possibly avoid destroy/create updates if they are not acceptable in some situations.

    Popularity 1/10 Helpfulness 1/10 Language whatever
    Source: Grepper
    Link to this answer
    Share Copy Link
    Contributed on May 14 2023
    Sumit Rawal
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.