-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Provider produced inconsistent final plan / an invalid new value for .tags_all #19583
Comments
Thank you for reporting this issue @chgasparoto ! This seems related to the the apply-time computed tag,
|
If anyone figures out a work around in the meantime, please paste it here. |
My work around is:
|
Hi @matiu2 , thank you for following up on this issue! I don't believe there is a current workaround when using an apply-time Computed key/value pair like Following the steps you've provided, if I'm using a timestamp value in the |
Hello, RESOURCE : resource "aws_ami_copy" "server_encrypted" {
name = format("encrypted-server-ami.%s", local.timestamp_sanitized)
description = format("server (encrypted) created on : %s", local.timestamp_sanitized)
source_ami_id = data.aws_ami.latest_server.id
source_ami_region = var.region
encrypted = true
kms_key_id = var.kms_key_id
tags = {
Name = format("encrypted-server-ami.%s", local.timestamp_sanitized)
}
} PROVIDER :
ERROR
Regards |
Hi, same error here when adding an extra "Name" tag to a S3 bucket. Used versions
Expected BehaviorS3 bucket created with default tags + customized tags successfully Actual BehaviorS3 bucket is not created Code snippetprovider "aws" {
profile = var.aws_profile
region = var.aws_region
default_tags {
tags = {
Created_by = "Terraform"
Project = "AWS_demo_fullstack_devops"
}
}
}
resource "aws_s3_bucket" "s3_bucket" {
bucket = var.bucket_name
acl = "private"
force_destroy = true
tags = {
Name = var.bucket_name
}
} Plan output
Error output (during apply)
Regards, |
Thank you for providing additional context @ashraf133 and @Marinaburkhardt ! In both cases seems having a resource |
I just ran into the same issue here with config from this pull request running in this workspace. Update: I received the same error when I removed the computed |
Error seems to be fixed, I retried the deployment and now it worked. But the output doesn't show up as expected: Apply output:
I think the "Name" tag shouldn't be listed under Hope that helps 😄 |
@Marinaburkhardt the one resource type I don't have this problem with is S3 buckets, lots of other resource have this problem for me (RDS, Route53, Elasticsearch, cognito, and others) |
Same for me, how to upvote for this issue? How to Fix: just launch again
|
Another case where this bug hurts, using the ALB module https://registry.terraform.io/modules/terraform-aws-modules/alb/aws/latest
From plan. Note the code attempts to add a Name tag to
My versions:
|
I ran into this with the AWS EKS module as well.
For my own instance of this, I was able to resolve it by removing the space in the tag.Name value I was using and replace with My Version:
|
declare the default tags as local variable |
I ran into this with the rds cluster resource. Terraform v1.0.2 and aws provider v3.50.0: provider "aws" {
region = var.aws_region
allowed_account_ids = [var.aws_account_id]
default_tags {
tags = {
Terraform = "true"
}
}
}
resource "aws_rds_cluster" "clone" {
...
tags = {
Name = "clone"
Created = timestamp()
}
}
|
Please remove the default tags and put that tag in local variable. |
We are upgrading to Terraform v0.12.31 and AWS provider v3.38.0 Our current terraform configuration looks like this -provider aws { locals { resource aws_dynamodb_table xyz { Code output -aws_dynamodb_table.xyz will be updated in-place When we run the terraform files, getting below error -Provider produced inconsistent final plan The same configuration works when we manually delete the existing Dynamo DB table and re-run the files. But we want to avoid getting this error in first place. What changes do we need to make in our files to avoid this error ? Code output (when tables are deleted manually) -aws_dynamodb_table.xyz will be created |
I ran into the same error with the
I was able to work around the error by re-running |
Sam issue for me |
For those who face this issue with a default tag value set to To avoid this problem I use a variable that contains the timestamp which is set just prior to the apply.
This works with |
Having this same issue with TF 1.0,9 when applying tags to |
We have also hit this issue in a slightly different form whereas a depends_on on the resource will cause a diff in tags vs tags_all at plan time even though all of the tags are statically defined. Works completely fine when dependencies are automatically determined; kinda weird. |
still confirmed with Terraform 1.0.10 and aws provider 3.64.x.. if I have a dynamic (in my case a random id) as part of default_tags set in the provider configs, my apply run is very inconsistent. |
Think this issue might be getting fixed in next major release of the provider #29842 |
Hi there, resource "aws_subnet" "spacelift_public_subnet" {
vpc_id = var.vpc_id
count = length(var.spacelift_public_subnets_cidr)
cidr_block = element(var.spacelift_public_subnets_cidr, count.index)
availability_zone_id = element(var.availability_zone_ids, count.index)
map_public_ip_on_launch = true
tags = {
Name = "${var.name}-${element(var.availability_zone_ids, count.index)}-public-subnet"
}
}
resource "aws_security_group" "spacelift_sg" {
description = "Security group to allow inbound/outbound from the VPC"
vpc_id = var.vpc_id
ingress {
from_port = 0
to_port = 0
protocol = "-1"
# Primary vpc cidr in infrastructure-management account.
cidr_blocks = [var.vpc_cidr]
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
tags = {
Name = "${var.name}"
}
} In some runs this fails. Error: Provider produced inconsistent final plan |
another victim of this bug, please fix Hashicorp 😢 |
Hi, there. A new victim appears. Version:
I use eks blueprints, but basically the problem lies on the managed node group. module "eks_blueprints" {
source = "github.com/aws-ia/terraform-aws-eks-blueprints?ref=v4.25.0"
tags = local.tags
} Error output:
|
one more victim. @johnsonaj when you say it is merged that means this problem is fixed? what version of TF we need to use? |
another victim │ Error: Provider produced inconsistent final plan |
@rajmartha26 we have done work to allow resource It is still not possible to have The following configuration will be possible in provider "aws" {
region = "us-west-2"
}
resource "aws_s3_bucket" "example" {
bucket = "example-bucket"
tags = {
created_at = timestamp()
}
} However, the follow will still not compute correctly because provider "aws" {
region = "us-west-2"
default_tags {
tags = {
created_at = timestamp()
}
}
}
resource "aws_s3_bucket" "example" {
bucket = "example-bucket"
tags = {
additional_tag = "value
}
} |
@johnsonaj something like below will be possible in v5.0.0 ?
|
@rajmartha26 yes, that will be possible when |
@johnsonaj The timestamp() function will change values on every run since it includes time, so we add that in ignore_changes, Any time line when the v5 will release? |
Hi @johnsonaj I am not sure what constitutes a 'computed value'; does it include vars passed in via I am standing up EKS and deploying a bunch of Helm charts ( |
This functionality has been released in v5.0.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
I don't think this is fixed in v5.1.0 of Terraform AWS Provider |
@rmetzler Can you please provide more information why you think that? Ideally a minimal reproduction so others can understand why you think that? |
I'm also observing the issue today, but I don't know how to reproduce |
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. |
Community Note
Terraform CLI and Terraform AWS Provider Version
Terraform v0.15.4
on darwin_amd64
Affected Resource(s)
Terraform Configuration Files
Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.
Debug Output
Panic Output
Expected Behavior
VPC and Network created with default tags successfully
Actual Behavior
VPC and Network are not created
Steps to Reproduce
terraform apply
Important Factoids
References
The text was updated successfully, but these errors were encountered: