Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Inconsistent final plan with tags_all when using apply time values as resource tags #30756

Closed
ryancausey opened this issue Apr 15, 2023 · 3 comments
Labels
bug Addresses a defect in current functionality. service/vpc Issues and PRs that pertain to the vpc service. tags Pertains to resource tagging.

Comments

@ryancausey
Copy link

Terraform Core Version

v1.3.9

AWS Provider Version

v4.63.0

Affected Resource(s)

  • aws_vpc

Expected Behavior

The final plan should have been consistent and applied correctly.

Actual Behavior

An error occurred where the apply step failed with an error that the AWS provider produced an inconsistent final plan.

Relevant Error/Panic Output Snippet

╷
│ Error: Provider produced inconsistent final plan
│ 
│ When expanding the plan for aws_vpc.main to include new values learned so
│ far during apply, provider "registry.terraform.io/hashicorp/aws" produced
│ an invalid new value for .tags_all: new element "name" has appeared.
│ 
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.

Terraform Configuration Files

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "4.63.0"
    }
    random = {
      source  = "hashicorp/random"
      version = "3.5.1"
    }
  }
}

provider "aws" {
  region = "us-west-2"

  # Always tag these resourcew as terraform managed and with the envrironment info.
  default_tags {
    tags = {
      group_name        = "test"
      project_name      = "test-vpc-resources"
      terraform_managed = "true"
      environment_name  = "test_env"
      release_version   = "0.0.1"
      deployed_by       = "test_person"
    }
  }
}

# Produce a unique random name. This is mainly to support review apps in GitLab.
resource "random_id" "main_vpc_name" {
  byte_length = 8
  prefix      = "main"
}

# The VPC to instantiate.
resource "aws_vpc" "main" {
  cidr_block = "10.0.0.0/16"

  tags = { name = random_id.main_vpc_name.dec }
}

Steps to Reproduce

  1. configure AWS credentials needed to apply the VPC resources.
  2. run terraform init using the minimal reproduction sample provided.
  3. run terraform plan -out plan.tfplan.
  4. run `terraform apply plan.tfplan

Debug Output

No response

Panic Output

No response

Important Factoids

Workaround: re-planning and then applying the new plan seems to make the inconsistency error go away. Likely because the random resource would have been applied and the new plan could take its resulting value into account at plan time.

References

No response

Would you like to implement a fix?

None

@ryancausey ryancausey added bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. labels Apr 15, 2023
@github-actions github-actions bot added the service/vpc Issues and PRs that pertain to the vpc service. label Apr 15, 2023
@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@ewbankkit ewbankkit added tags Pertains to resource tagging. and removed needs-triage Waiting for first response or review from a maintainer. labels Apr 16, 2023
@ewbankkit
Copy link
Contributor

@ryancausey Thanks for raising this issue.
It has already been noticed in #19583. I'm going to close this one as a duplicate so that we can concentrate discussion in the linked issue.
Please add any additional comments there.

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/vpc Issues and PRs that pertain to the vpc service. tags Pertains to resource tagging.
Projects
None yet
Development

No branches or pull requests

2 participants