I've got some code which:
1. Creates an AWS account (using AWS Classic organizations)
2. Does various configuration within the account, including early-on trying to create a few Secrets Manager secrets
Step 2 seems to always fail with "creating Secrets Manager Secret: SubscriptionRequiredException: The AWS Access Key Id needs a subscription for the service", but if I wait for 30 seconds or so then re-try it works.
Is there a way to poll for subscriptions to be available, or even just bake in a delay before anything that depends on the account can proceed?
l
little-cartoon-10569
05/31/2024, 8:52 PM
Baking in a delay will be hard, since your code is run before deployment, during the state creation phase. I find it easier to solve this sort of problem by splitting the code into projects. Create the account in one project, wait a few seconds, and then create the secrets in a different project.
If you use automation-api, you can put both projects inline in a single file, if you want to.