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.85k stars 9.2k forks source link

[Bug]: Amplify Domain Association fails with `unexpected state AWAITING_APP_CNAME` #29791

Open kiik7r opened 1 year ago

kiik7r commented 1 year ago

Terraform Core Version

v1.3.9

AWS Provider Version

v4.57.0

Affected Resource(s)

Expected Behavior

When creating an Amplify domain association with the flag wait_for_verification set to true (default), terraform should wait for the domain to be associated.

Actual Behavior

Terraform fails with the following error:

waiting for Amplify Domain Association (<redacted>/<redacted>) to verify: unexpected state 'AWAITING_APP_CNAME', wanted target 'PENDING_DEPLOYMENT, AVAILABLE'. last error: %!s(<nil>)

Seems like AWS introduced a new state not handled by the provider.

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

The default example on the resource documentation: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/amplify_domain_association

You need to change the domain used with one you own.

Steps to Reproduce

Run the example from https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/amplify_domain_association.

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 1 year ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

robmoss2k commented 7 months ago

We are still affected by this bug. Is it a simple fix?

andrewsbayshann commented 7 months ago

Note to anyone dealing with this - rerunning after a couple of minutes made it work.

robmoss2k commented 7 months ago

I created a draft pull request for this. If someone is able to run the Amplify domain association test, we can turn it into a proper PR. I'm on Windows. I couldn't get the tests to run in my VSCode console, and in WSL, I ran out of memory trying to run them.

robmoss2k commented 7 months ago

Anyone?

robmoss2k commented 7 months ago

Note to anyone dealing with this - rerunning after a couple of minutes made it work.

Note to anyone following this advice - if you don't untaint the resource, Terraform will destroy and recreate it and end up in the same state, unless you get lucky and Terraform checks the resource either side of AWAITING_APP_CNAME. This issue doesn't occur 100% of the time - about 90% for me, but YMMV.

MrLightful commented 2 months ago

There's also a IMPORTING_CUSTOM_CERTIFICATE missing.

Error: waiting for Amplify Domain Association (***/dizconto.com) create: unexpected state 
'IMPORTING_CUSTOM_CERTIFICATE', wanted target 'PENDING_VERIFICATION, PENDING_DEPLOYMENT, AVAILABLE'. 
last error: %!s(<nil>)
PlayJok3r commented 4 days ago

Will IMPORTING_CUSTOM_CERTIFICATE be added to wanted targets?