terraform-provider-aws: Provider produced inconsistent result after apply - aws_vpc_endpoint_route_table_association.s3_vpc_endpoint
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 0.12.23 aws provider version 2.51.0
Affected Resource(s)
aws_vpc_endpoint_route_table_association.s3_vpc_endpoint
Terraform Configuration Files
resource "aws_route_table" "private_subnet_rtb" {
count = length(var.availability_zones) * var.flag
vpc_id = aws_vpc.vpc[0].id
}
resource "aws_vpc_endpoint_route_table_association" "s3_vpc_endpoint" {
vpc_endpoint_id = aws_vpc_endpoint.s3[0].id
count = length(var.availability_zones) * var.flag
route_table_id = element(aws_route_table.private_subnet_rtb.*.id, count.index)
}
resource "aws_vpc_endpoint" "s3" {
count = var.flag
vpc_id = aws_vpc.vpc[0].id
service_name = "com.amazonaws.${data.aws_region.current.name}.s3"
}
Debug Output
Error: Provider produced inconsistent result after apply vpc.aws_vpc_endpoint_route_table_association.s3_vpc_endpoint[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…
Expected Behavior
Terraform apply should have been successful
Actual Behavior
Terraform apply fails
Steps to Reproduce
This does not happen all the time, running apply multiple times
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 49
- Comments: 21 (11 by maintainers)
Commits related to this issue
- resource/aws_vpc_endpoint_route_table_association: Handle read-after-create eventual consistency Reference: https://github.com/hashicorp/terraform-provider-aws/issues/12449 Reference: https://github.... — committed to hashicorp/terraform-provider-aws by bflad 3 years ago
- resource/aws_vpc_endpoint_route_table_association: Handle read-after-create eventual consistency (#18465) Reference: https://github.com/hashicorp/terraform-provider-aws/issues/12449 Reference: https... — committed to hashicorp/terraform-provider-aws by bflad 3 years ago
We are on Terraform 0.13.3 and on hashicorp/aws v2.70.0.
Apply failed with
The next apply failed with
So did the one after it.
We had to manually detach the Security Group, then apply again. That resolved it.
aws_vpc_endpoint_route_table_associationissue addressed in #16200.aws_network_interface_sg_attachmentissue raised in #16201.I have noticed that the
aws_vpc_endpoint_subnet_associationresource which makes very similar AWS API calls to theaws_vpc_endpoint_route_table_associationresource has a call tovpcEndpointWaitUntilAvailablehttps://github.com/hashicorp/terraform-provider-aws/blob/63df631903b9f3c452d2cdc8aebd1976f870e7d3/aws/resource_aws_vpc_endpoint.go#L458-L471
whereas the route table association does not wait for the VPC endpoint to reach
availablestate. I can see no harm in adding such a call.Same issue. Encountered with TF v0.12.28, and provider v3.11.0.