0.12.3
### Terraform Configuration Files
provider "aws" {
region = "us-east-1"
version = "~> 2.15"
}
resource "aws_s3_bucket" "my-awesome-bucket-123456" {
bucket = "my-awesome-bucket-123456"
}
### Expected Behavior
I expect an empty result for `terraform show`, as in 0.11. Having said that, I cannot find any doc which specifies what the output _should_ be.
### Actual Behavior
I see:
? aws_s3_bucket.my-awesome-bucket-123456
for resources which are not planned to change.
### Steps to Reproduce
With the following terraform file:
provider "aws" {
region = "us-east-1"
version = "~> 2.15"
}
resource "aws_s3_bucket" "my-awesome-bucket-123456" {
bucket = "my-awesome-bucket-123456"
}
then do:
terraform apply # choose "yes" to create the bucket
terraform plan -out plan_file # note: "No changes. Infrastructure is up-to-date."
terraform show plan_file
? aws_s3_bucket.my-awesome-bucket-123456
Here's my full session, which includes terraform output:
$ terraform apply An execution plan has been generated and is shown below. Resource actions are indicated with the following symbols: + create Terraform will perform the following actions: # aws_s3_bucket.my-awesome-bucket-123456 will be created + resource "aws_s3_bucket" "my-awesome-bucket-123456" { + acceleration_status = (known after apply) + acl = "private" + arn = (known after apply) + bucket = "my-awesome-bucket-123456" + bucket_domain_name = (known after apply) + bucket_regional_domain_name = (known after apply) + force_destroy = false + hosted_zone_id = (known after apply) + id = (known after apply) + region = (known after apply) + request_payer = (known after apply) + website_domain = (known after apply) + website_endpoint = (known after apply) + versioning { + enabled = (known after apply) + mfa_delete = (known after apply) } } Plan: 1 to add, 0 to change, 0 to destroy. Do you want to perform these actions? Terraform will perform the actions described above. Only 'yes' will be accepted to approve. Enter a value: yes aws_s3_bucket.my-awesome-bucket-123456: Creating... aws_s3_bucket.my-awesome-bucket-123456: Still creating... [10s elapsed] aws_s3_bucket.my-awesome-bucket-123456: Creation complete after 16s [id=my-awesome-bucket-123456] Apply complete! Resources: 1 added, 0 changed, 0 destroyed. $ terraform plan -out plan_file Refreshing Terraform state in-memory prior to plan... The refreshed state will be used to calculate this plan, but will not be persisted to local or remote state storage. aws_s3_bucket.my-awesome-bucket-123456: Refreshing state... [id=my-awesome-bucket-123456] ------------------------------------------------------------------------ No changes. Infrastructure is up-to-date. This means that Terraform did not detect any differences between your configuration and real physical resources that exist. As a result, no actions need to be performed. $ terraform show plan_file ? aws_s3_bucket.my-awesome-bucket-123456
I've had a crack at fixing it in https://github.com/hashicorp/terraform/pull/21911.
My first foray in to go, let alone terraform, so be nice :-)
@jkburges Thanks for submitting that PR, it seems strange that the show command is returning that output. We'll likely have to look into that first before reviewing the PR, did your fix change the output in the example above?
Yes, the output of terraform show is now "This plan does nothing.", as expected.
Full session (with #21911 build):
$ ~/go/src/github.com/hashicorp/terraform/pkg/darwin_amd64/terraform plan Refreshing Terraform state in-memory prior to plan... The refreshed state will be used to calculate this plan, but will not be persisted to local or remote state storage. ------------------------------------------------------------------------ An execution plan has been generated and is shown below. Resource actions are indicated with the following symbols: + create Terraform will perform the following actions: # aws_s3_bucket.my-awesome-bucket-123456 will be created + resource "aws_s3_bucket" "my-awesome-bucket-123456" { + acceleration_status = (known after apply) + acl = "private" + arn = (known after apply) + bucket = "my-awesome-bucket-123456" + bucket_domain_name = (known after apply) + bucket_regional_domain_name = (known after apply) + force_destroy = false + hosted_zone_id = (known after apply) + id = (known after apply) + region = (known after apply) + request_payer = (known after apply) + website_domain = (known after apply) + website_endpoint = (known after apply) + versioning { + enabled = (known after apply) + mfa_delete = (known after apply) } } Plan: 1 to add, 0 to change, 0 to destroy. ------------------------------------------------------------------------ Note: You didn't specify an "-out" parameter to save this plan, so Terraform can't guarantee that exactly these actions will be performed if "terraform apply" is subsequently run. $ ~/go/src/github.com/hashicorp/terraform/pkg/darwin_amd64/terraform apply An execution plan has been generated and is shown below. Resource actions are indicated with the following symbols: + create Terraform will perform the following actions: # aws_s3_bucket.my-awesome-bucket-123456 will be created + resource "aws_s3_bucket" "my-awesome-bucket-123456" { + acceleration_status = (known after apply) + acl = "private" + arn = (known after apply) + bucket = "my-awesome-bucket-123456" + bucket_domain_name = (known after apply) + bucket_regional_domain_name = (known after apply) + force_destroy = false + hosted_zone_id = (known after apply) + id = (known after apply) + region = (known after apply) + request_payer = (known after apply) + website_domain = (known after apply) + website_endpoint = (known after apply) + versioning { + enabled = (known after apply) + mfa_delete = (known after apply) } } Plan: 1 to add, 0 to change, 0 to destroy. Do you want to perform these actions? Terraform will perform the actions described above. Only 'yes' will be accepted to approve. Enter a value: yes aws_s3_bucket.my-awesome-bucket-123456: Creating... aws_s3_bucket.my-awesome-bucket-123456: Still creating... [10s elapsed] aws_s3_bucket.my-awesome-bucket-123456: Creation complete after 16s [id=my-awesome-bucket-123456] Apply complete! Resources: 1 added, 0 changed, 0 destroyed. $ ~/go/src/github.com/hashicorp/terraform/pkg/darwin_amd64/terraform plan -out plan_file Refreshing Terraform state in-memory prior to plan... The refreshed state will be used to calculate this plan, but will not be persisted to local or remote state storage. aws_s3_bucket.my-awesome-bucket-123456: Refreshing state... [id=my-awesome-bucket-123456] ------------------------------------------------------------------------ No changes. Infrastructure is up-to-date. This means that Terraform did not detect any differences between your configuration and real physical resources that exist. As a result, no actions need to be performed. $ ~/go/src/github.com/hashicorp/terraform/pkg/darwin_amd64/terraform show plan_file This plan does nothing.
We also have the same issue, I just upgraded to terraform 0.12 and now when running terraform show FILE it outputs all resources with a ? instead outputting This plan does nothing.
Hi all,
This does seem to be an oversight with how the internal plan models changed in Terraform 0.12... the in-memory and saved plan now includes an entry for every resource instance, even if no change is required, so that the plan contains as complete as possible a description of the planned final state. However, the UI components that render these are supposed to then filter out those "no-op" changes, showing only the ones that represent an actual change.
The terraform show seems to be lacking that filtering step, causing it to try to render no-op changes, and then that ? in the output is a result of it not having a change type "icon" to use for that situation.
I see that there's a PR linked here from @jkburges. I'm just reviewing the issue backlog right now so I'm going to continue on that rather than sidetracking, but we'll see about reviewing that PR soon. Thanks!
I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Most helpful comment
Hi all,
This does seem to be an oversight with how the internal plan models changed in Terraform 0.12... the in-memory and saved plan now includes an entry for every resource instance, even if no change is required, so that the plan contains as complete as possible a description of the planned final state. However, the UI components that render these are supposed to then filter out those "no-op" changes, showing only the ones that represent an actual change.
The
terraform showseems to be lacking that filtering step, causing it to try to render no-op changes, and then that?in the output is a result of it not having a change type "icon" to use for that situation.I see that there's a PR linked here from @jkburges. I'm just reviewing the issue backlog right now so I'm going to continue on that rather than sidetracking, but we'll see about reviewing that PR soon. Thanks!