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

[datadog_integration_aws_*] Validate AWS account ID and improve error handling #2201

Merged
merged 6 commits into from
Dec 14, 2023

Conversation

rjhornsby
Copy link
Contributor

Attempting to resolve issue #2200

Until sometime recently, fedramp DD API required the AWS account ID argument to be an IAM access key ID when the TF provider resource asked for the AWS account_id. This seems to have changed to match the commercial behavior where the account id argument is expected to get the actual account ID.

However, the API change broke the provider in a way that the provider cannot handle. It ends up crashing in the middle of the terraform apply:

Error: Provider produced inconsistent result after apply
│
│ When applying changes to datadog_integration_aws_lambda_arn.datadog-forwarder-global, provider "provider[\"registry.terraform.io/datadog/datadog\"]" 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.

This PR does not address the underlying handling of the invalid/unhandled API response, but instead tries to avoid it by ensuring the AWS account ID is a 12 digit string, and providing useful feedback if it does not - ie in the case of code which might still be using the IAM access key.

@rjhornsby rjhornsby requested review from a team as code owners December 7, 2023 03:47
@nkzou
Copy link
Contributor

nkzou commented Dec 7, 2023

Hi there, thanks for the PR and raising the issue on the breaking change.
We're currently verifying some things internally with the aws integration API, and I'm also working on a small refactor + better error handling for aws resources so we can avoid the unhelpful "inconsistent state" errors. Should have an update soon.

@nkzou nkzou changed the title Validate AWS account ID [datadog_integration_aws_*] Validate AWS account ID and improve error handling Dec 8, 2023
@nkzou nkzou linked an issue Dec 11, 2023 that may be closed by this pull request
@nkzou nkzou merged commit 30b669d into DataDog:master Dec 14, 2023
8 of 9 checks passed
@andrew-purdin
Copy link

@nkzou is everything fixed with this now, or are there more API changes coming? We also had a sudden break in our Datadog/AWS integration IaC from the related issue here.

@nkzou
Copy link
Contributor

nkzou commented Jan 12, 2024

Things should be stable now. Are you running into issues still?

@andrew-purdin
Copy link

Yes, but we are stuck on version 3.30.0 of the provider for the time being and are unable to upgrade. I expect we are continuing to see issues due to the recent API changes not being backward compatible with 3.30.0, is that correct?

@nkzou
Copy link
Contributor

nkzou commented Jan 12, 2024

Yes, unfortunately #2154 is the PR with the key fix for this issue (the PR we're on is just validation/error handling). The earliest version with the bugfix is 3.32.0.

@andrew-purdin
Copy link

Thanks for clarifying. Just out of curiosity, is there a source we can follow for breaking API changes like this on the DD side? It was tough for us to determine the source of this problem at first.

@rjhornsby
Copy link
Contributor Author

Thanks for clarifying. Just out of curiosity, is there a source we can follow for breaking API changes like this on the DD side? It was tough for us to determine the source of this problem at first.

+1. I spent a few hours tracking this down by diving into the provider code and then the API's behavior to finally figure out it was an API change. Because we couldn't figure out what was going on, DD support also had to spend time internally running this down.

At minimum the folks responsible for the API need to please communicate with the internal consumers like the folks responsible for the TF provider that an API change is coming so this doesn't send folks like @andrew-purdin and myself running in circles trying to understand what we did wrong.

@nkzou
Copy link
Contributor

nkzou commented Jan 12, 2024

Breaking changes like this should only happen in very specific and rare cases, so there isn't a specific place to look for updates about them. With that being said, we've received your feedback about this and have passed it along to the relevant team.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

api.ddog-gov.com API change breaks dd_integration_aws resources
4 participants