'No changes. Infrastructure is up-to-date. terraform plan
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
}
}
}
provider "aws" {
region = "us-east-1"
access_key = "<my-key->"
secret_key = "<my-sec-key>"
}
resource "aws_instance" "terra-instance" {
ami = "ami-09e67e426f25ce0d7"
instance_type = "t2.micro"
}
I am new to terraform and have encountered this issue. I am trying to create an instance in AWS cloud using terraform and when I issue "terraform plan" it says "No changes. Infrastructure is up-to-date."
can some one help me on this?
adarshpatil@Adarshs-MacBook-Pro Project-1 % terraform apply Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
Solution 1:[1]
If your intent is to force replacement of a particular object even though there are no configuration changes that would require it, we recommend instead to use the -replace option with terraform apply. For example:
terraform apply -replace="aws_instance.terra-instance[0]"
Creating a plan with the "replace" option is superior to using terraform taint because it will allow you to see the full effect of that change before you take any externally-visible action. When you use terraform taint to get a similar effect, you risk someone else on your team creating a new plan against your tainted object before you've had a chance to review the consequences of that change yourself.
The -replace=... option to terraform apply is only available from Terraform v1.0 onwards, so if you are using an earlier version you will need to use terraform taint to force object replacement, while considering the caveats described above.
»Usage
Usage: terraform taint [options] address
source : https://www.terraform.io/docs/cli/commands/taint.html
Solution 2:[2]
This means your infrastructure is already deployed and no changes are detected. Try to change the instance_type
to something else and try again. You will see a plan with the necessary changes.
Solution 3:[3]
Check your aws credentials file contents and see if they match your access_key and secret key.
Solution 4:[4]
For the Terraform tutorial, change the name of the instance to "app_server2" run 'terraform init ' again and terraform apply. It's common when you try the tutorial serveral times that the lock file , retains the old name and thinks that the instance is already deployed.
Solution 5:[5]
I had the same problem. The solution is pretty easy: save all before you run any terraform command.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Rajan Sharma |
Solution 2 | 54m |
Solution 3 | santosh |
Solution 4 | user1880022 |
Solution 5 | Tamar |