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

resource/aws_ec2_transit_gateway_route_table_propagation: Error: Provider produced inconsistent result after apply - resource have been created - and TFE cannot apply again #14043

Closed
arnvid opened this issue Jul 3, 2020 · 6 comments · Fixed by #18470
Assignees
Labels
bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service.
Milestone

Comments

@arnvid
Copy link

arnvid commented Jul 3, 2020

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • 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
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

Terraform Enterprise
0.12.28

Affected Resource(s)

aws_ec2_transit_gateway_vpc_attachment.vpc_attachment
aws_ec2_transit_gateway_route_table_propagation.route_table_propagation

Terraform Configuration Files

This is part of deploying a baseline which is deployed on account 120 so far....

Panic Output

Error: Provider produced inconsistent result after apply

When applying changes to
module.tgw-vpc-attachment.aws_ec2_transit_gateway_route_table_propagation.route_table_propagation[2],
provider "registry.terraform.io/-/aws" produced an unexpected new value for
was present, but now absent.

This is a bug in the provider, which should be reported in the provider's own
issue tracker.

And on runs after:

module.tgw-vpc-attachment.aws_ec2_transit_gateway_vpc_attachment.vpc_attachment[0]: Modifications complete after 1s [id=tgw-attach-xxxx]
module.tgw-vpc-attachment.aws_ec2_transit_gateway_route_table_propagation.route_table_propagation[2]: Creating...

Error: error enabling EC2 Transit Gateway Route Table (tgw-rtb-xxxx) propagation (tgw-attach-xxx): TransitGatewayRouteTablePropagation.Duplicate: Propagation tgw-attach-xxx already exists in Transit Gateway Route Table tgw-rtb-xxx.
status code: 400, request id: 9a4ea138-cb93-xx-xxx-xx

on .terraform/modules/tgw-vpc-attachment/main.tf line 62, in resource "aws_ec2_transit_gateway_route_table_propagation" "route_table_propagation":
62: resource "aws_ec2_transit_gateway_route_table_propagation" "route_table_propagation" {

Expected Behavior

Transit Gateway propogation should happen and statefile should be writen

Actual Behavior

Terraform statefile thinks that the propogation is not done.

Steps to Reproduce

Not sure how to reproduce at this stage. This has been run many any times before.. rerunning the workspace does not fix it. Hopefully it will not happen on the next workspaces.. we are deploying 5-15 accounts a day..

  • #0000
@ghost ghost added the service/ec2 Issues and PRs that pertain to the ec2 service. label Jul 3, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Jul 3, 2020
@breathingdust breathingdust added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Jul 3, 2020
@mkielar
Copy link
Contributor

mkielar commented Aug 10, 2020

I'm seeing similar issue with appmesh:

Error: Provider produced inconsistent result after apply
When applying changes to
module.[MASKED].module.webapp1.aws_appmesh_virtual_node.vn["green"],
provider "registry.terraform.io/-/aws" produced an unexpected new value for
was present, but now absent.
This is a bug in the provider, which should be reported in the provider's own
issue tracker.

The issue is quite random, and it's quite hard to reproduce, but the AWS Resource (Virtual Node in Appmesh) gets created without Terraform storing any mention of it in statefile. This causes terraform to fail on retry.

Terraform: v0.12.26
Providers:
- "aws" (hashicorp/aws) 2.70.0...
- "external" (hashicorp/external) 1.2.0...
- "null" (hashicorp/null) 2.1.2...
- "random" (hashicorp/random) 2.3.0...

Let me know if that belongs here, or you'd like another ticket specifically for AppMesh.

@mkielar
Copy link
Contributor

mkielar commented Oct 1, 2020

And today with aws_vpc_endpoint_route_table_association:

Error: Provider produced inconsistent result after apply
When applying changes to
module.core_infrastructure.module.main_vpc.module.vpc.aws_vpc_endpoint_route_table_association.private_s3[0],
provider "registry.terraform.io/-/aws" produced an unexpected new value for
was present, but now absent.
This is a bug in the provider, which should be reported in the provider's own
issue tracker.
Terraform v0.12.29
Providers:
- "template" (hashicorp/template) 2.1.2
- "null" (hashicorp/null) 2.1.2
- "aws" (hashicorp/aws) 3.8.0

@mkielar
Copy link
Contributor

mkielar commented Oct 1, 2020

Is this one related?
#15084

This seems to me like a general issue with AWS Provider, perhaps there should ba a centralised fix for this type of issues?

@stefangreim
Copy link

Same for aws_ec2_transit_gateway_route resource.

@bflad bflad changed the title Error: Provider produced inconsistent result after apply - resource have been created - and TFE cannot apply again resource/aws_ec2_transit_gateway_route_table_propagation: Error: Provider produced inconsistent result after apply - resource have been created - and TFE cannot apply again Mar 24, 2021
@bflad bflad self-assigned this Mar 29, 2021
bflad added a commit that referenced this issue Mar 29, 2021
…able and disable operations to complete

Reference: #14043
Reference: #16796

The waiter should help prevent the read-after-create eventual consistency issue, but also added the `d.IsNewResource()` checks to ensure the confusing Terraform CLI error is prevented.

Output from acceptance testing in AWS Commercial:

```
--- PASS: TestAccAWSEc2TransitGatewayRouteTablePropagation_basic (385.06s)
```

Output from acceptance testing in AWS GovCloud (US):

```
--- PASS: TestAccAWSEc2TransitGatewayRouteTablePropagation_basic (348.55s)
```
bflad added a commit that referenced this issue Mar 31, 2021
…able and disable operations to complete (#18470)

* resource/aws_ec2_transit_gateway_route_table_propagation: Wait for enable and disable operations to complete

Reference: #14043
Reference: #16796

The waiter should help prevent the read-after-create eventual consistency issue, but also added the `d.IsNewResource()` checks to ensure the confusing Terraform CLI error is prevented.

Output from acceptance testing in AWS Commercial:

```
--- PASS: TestAccAWSEc2TransitGatewayRouteTablePropagation_basic (385.06s)
```

Output from acceptance testing in AWS GovCloud (US):

```
--- PASS: TestAccAWSEc2TransitGatewayRouteTablePropagation_basic (348.55s)
```

* Update CHANGELOG for #18470
@github-actions github-actions bot added this to the v3.35.0 milestone Mar 31, 2021
@ghost
Copy link

ghost commented Apr 1, 2021

This has been released in version 3.35.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 for triage. Thanks!

@ghost
Copy link

ghost commented Apr 30, 2021

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Apr 30, 2021
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/ec2 Issues and PRs that pertain to the ec2 service.
Projects
None yet
5 participants