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

Provider produced inconsistent final plan #380

Closed
1 task done
sithilaKonara opened this issue Mar 6, 2023 · 2 comments
Closed
1 task done

Provider produced inconsistent final plan #380

sithilaKonara opened this issue Mar 6, 2023 · 2 comments
Assignees
Labels

Comments

@sithilaKonara
Copy link

Terraform CLI and Provider Versions

Using the Terraform cloud to triggrer deployments
Terraform v1.3.9

Terraform Configuration

resource "random_string" "random" {
  length  = 4
  special = false
}

resource "aws_vpc" "r_vpc" {
  cidr_block           = "10.5.0.0/16"
  enable_dns_support   = true
  enable_dns_hostnames = true
  tags = {
    "Name" = "${var.v_project_name}_vpc_${random_string.random.result}"
  }
}

Expected Behavior

VPC should get created

Actual Behavior

�Terraform v1.3.9
on linux_amd64
random_string.random: Creating...
random_string.random: Creation complete after 0s [id=GOPP]

│ Error: Provider produced inconsistent final plan

│ When expanding the plan for aws_vpc.r_vpc 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.

Operation failed: failed running terraform apply (exit 1)�

Steps to Reproduce

  1. terraform apply

How much impact is this issue causing?

Medium

Logs

No response

Additional Information

Log file expoted from the terraform cloud

�Terraform v1.3.9
on linux_amd64
�[0m�[1mrandom_string.random: Creating...�[0m�[0m
�[0m�[1mrandom_string.random: Creation complete after 0s [id=GOPP]�[0m
�[31m╷�[0m�[0m
�[31m│�[0m �[0m�[1m�[31mError: �[0m�[0m�[1mProvider produced inconsistent final plan�[0m
�[31m│�[0m �[0m
�[31m│�[0m �[0m�[0mWhen expanding the plan for aws_vpc.r_vpc to include new values learned so
�[31m│�[0m �[0mfar during apply, provider "registry.terraform.io/hashicorp/aws" produced
�[31m│�[0m �[0man invalid new value for .tags_all: new element "Name" has appeared.
�[31m│�[0m �[0m
�[31m│�[0m �[0mThis is a bug in the provider, which should be reported in the provider's
�[31m│�[0m �[0mown issue tracker.
�[31m╵�[0m�[0m
Operation failed: failed running terraform apply (exit 1)�

Code of Conduct

  • I agree to follow this project's Code of Conduct
@bflad bflad self-assigned this Mar 6, 2023
@bflad
Copy link
Contributor

bflad commented Mar 6, 2023

Hi @sithilaKonara 👋 Thank you for reporting this issue and sorry you are running into trouble here.

While the Terraform output here mentions the hashicorp/random provider resources right before the error:

random_string.random: Creating...
random_string.random: Creation complete after 0s [id=GOPP]

The actual error message is being generated due to the hashicorp/aws provider:

│ When expanding the plan for aws_vpc.r_vpc 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.

It turns out this is a long-running issue with the AWS provider, hashicorp/terraform-provider-aws#19583. While those maintainers are on a different team than mine, I am aware that they are actively investigating a path forward to addressing that issue on their side.

Another angle with this issue is that hashicorp/random resources happen to be a very common cause for this issue to downstream resources. The reason for this is that many/all of the randomly generated values from this provider occur during Terraform's apply phase, instead of during Terraform's planning phase. Up until recently, it would have been more difficult to enhance the hashicorp/random provider to remove those unknown values during planning, but now we are much better positioned to handle this type of enhancement. This feature is being tracked in #121.

I would suggest following both the AWS provider and random provider issues for further updates on potential fixes, since it is not clear which fix may occur first. Since we are aware of this issue and the other two issues capture the necessary paths forward here, I'm going to close this issue. Thanks again for raising this.

@bflad bflad closed this as not planned Won't fix, can't repro, duplicate, stale Mar 6, 2023
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 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants