hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.83k stars 9.18k forks source link

[Bug]: aws_ses_event_destination: Provider produced inconsistent result after apply #38158

Open amh-mw opened 4 months ago

amh-mw commented 4 months ago

Terraform Core Version

1.9.0

AWS Provider Version

5.55.0

Affected Resource(s)

Expected Behavior

aws_ses_event_destination created without error

Actual Behavior

aws_ses_event_destination created with error (snippet below), then subsequent runs fail with

│ Error: creating SES configuration set event destination: EventDestinationAlreadyExists: Duplicate Event destination Name.

Relevant Error/Panic Output Snippet

│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to aws_ses_event_destination.test, provider "provider[\"registry.terraform.io/hashicorp/aws\"]" produced an unexpected new value: Root object was present, but now absent.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

Terraform Configuration Files

resource "aws_ses_event_destination" "test" {
  configuration_set_name = aws_ses_configuration_set.test.name
  enabled                = true
  matching_types         = ["send"]
  name                   = "test"

  sns_destination {
    topic_arn = aws_sns_topic.test.arn
  }
}

resource "aws_ses_configuration_set" "test" {
  name = "test"
}

resource "aws_sns_topic" "test" {
  name = "test"
}

Steps to Reproduce

terraform apply -auto-approve

Debug Output

2024-06-27T16:53:52.569Z [DEBUG] provider.terraform-provider-aws_v5.55.0_x5: HTTP Request Sent:
  http.request.body=
  | Action=DescribeConfigurationSet&ConfigurationSetAttributeNames.member.1=eventDestinations&ConfigurationSetName=test&Version=2010-12-01
   rpc.service=SES tf_rpc=ApplyResourceChange tf_mux_provider="*schema.GRPCProviderServer" @module=aws aws.region=us-east-1 http.request.header.authorization="AWS4-HMAC-SHA256 Credential=mock_access/20240627/us-east-1/ses/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date, Signature=*****" http.request.header.x_amz_date=20240627T165352Z rpc.method=DescribeConfigurationSet tf_provider_addr=registry.terraform.io/hashicorp/aws tf_resource_type=aws_ses_event_destination http.url=http://localstack:4566/ http.user_agent="APN/1.0 HashiCorp/1.0 Terraform/1.9.0 (+https://www.terraform.io) terraform-provider-aws/5.55.0 (+https://registry.terraform.io/providers/hashicorp/aws) aws-sdk-go/1.54.5 (go1.22.4; linux; amd64)" net.peer.name=localstack net.peer.port=4566 tf_req_id=bb6e2437-9124-073b-fafd-c45bc520e445 @caller=github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2@v2.0.0-beta.55/logger.go:109 http.flavor=1.1 http.method=POST http.request.header.content_type="application/x-www-form-urlencoded; charset=utf-8" http.request_content_length=134 rpc.system=aws-api tf_aws.sdk=aws-sdk-go timestamp=2024-06-27T16:53:52.569Z
2024-06-27T16:53:52.573Z [DEBUG] provider.terraform-provider-aws_v5.55.0_x5: HTTP Response Received: rpc.system=aws-api tf_mux_provider="*schema.GRPCProviderServer" tf_req_id=bb6e2437-9124-073b-fafd-c45bc520e445 aws.region=us-east-1 http.duration=3 http.response.header.content_type=text/xml http.response.header.server=TwistedWeb/24.3.0 rpc.service=SES tf_aws.sdk=aws-sdk-go http.response_content_length=372 tf_rpc=ApplyResourceChange @module=aws
  http.response.body=
  | <?xml version='1.0' encoding='utf-8'?>
  | <DescribeConfigurationSetResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/"><DescribeConfigurationSetResult><ConfigurationSet><Name>test</Name></ConfigurationSet></DescribeConfigurationSetResult><ResponseMetadata><RequestId>666a2fab-5c01-4b5d-8429-e5d799a18539</RequestId></ResponseMetadata></DescribeConfigurationSetResponse>
   http.response.header.date="Thu, 27 Jun 2024 16:53:52 GMT" rpc.method=DescribeConfigurationSet tf_provider_addr=registry.terraform.io/hashicorp/aws tf_resource_type=aws_ses_event_destination @caller=github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2@v2.0.0-beta.55/logger.go:157 http.status_code=200 timestamp=2024-06-27T16:53:52.573Z
2024-06-27T16:53:52.573Z [WARN]  provider.terraform-provider-aws_v5.55.0_x5: [WARN] SES Configuration Set Event Destination (test) not found, removing from state
2024-06-27T16:53:52.575Z [DEBUG] State storage *statemgr.Filesystem declined to persist a state snapshot
2024-06-27T16:53:52.575Z [ERROR] vertex "aws_ses_event_destination.test" error: Provider produced inconsistent result after apply
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to aws_ses_event_destination.test, provider "provider[\"registry.terraform.io/hashicorp/aws\"]" produced an unexpected new value: Root object was present, but now absent.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
2024-06-27T16:53:52.579Z [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2024-06-27T16:53:52.584Z [INFO]  provider: plugin process exited: plugin=.terraform/providers/registry.terraform.io/hashicorp/aws/5.55.0/linux_amd64/terraform-provider-aws_v5.55.0_x5 id=59
2024-06-27T16:53:52.584Z [DEBUG] provider: plugin exited

Panic Output

No response

Important Factoids

I am reproducing with hashicorp/terraform and localstack/localstack containers.

References

Related?

Would you like to implement a fix?

None

github-actions[bot] commented 4 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

justinretzolk commented 4 months ago

Hey @amh-mw 👋 Thank you for taking the time to raise this! You mentioned you're reproducing this with localstack. Are you experiencing the same issues when using the provider with AWS itself? We try not to break compatibility with localstack, etc., but we don't actively test against them, or promise compatibility.

amh-mw commented 4 months ago

I am unable to reproduce against AWS with

Terraform v1.9.0
on darwin_amd64
+ provider registry.terraform.io/hashicorp/aws v5.56.1