Open acaban-nuharbor opened 1 year ago
Voting for Prioritization
Volunteering to Work on This Issue
I did a bit of digging into this one as we had an RDS quota that was constantly re-applied.
With debug mode on I saw:
[DEBUG] provider.terraform-provider-aws_v4.67.0_x5: HTTP Response Received: @module=aws aws.operation=GetServiceQuota http.response_content_length=439 http.status_code=200 tf_provider_addr=registry.terraform.io/hashicorp/aws tf_resource_type=aws_servicequotas_service_quota aws.region=eu-west-2 http.response.header.content_type=application/x-amz-json-1.1 tf_mux_provider=*schema.GRPCProviderServer tf_req_id=ec5c395f-79e7-e7a7-d6d8-47a1f953efe8 tf_rpc=ReadResource aws.service="Service Quotas" http.response.body="{"Quota":{"Adjustable":true,"ErrorReason":{"ErrorCode":"DEPENDENCY_ACCESS_DENIED_ERROR","ErrorMessage":"You don’t have access to rds:DescribeAccountAttributes"},"GlobalQuota":false,"QuotaAppliedAtLevel":"ACCOUNT","QuotaArn":"arn:aws:servicequotas:eu-west-2:111111111111:rds/L-7B6409FD","QuotaCode":"L-7B6409FD","QuotaName":"DB instances","ServiceCode":"rds","ServiceName":"Amazon Relational Database Service (Amazon RDS)","Unit":"None"}}" http.response.header.x_amzn_requestid=0cce48da-2f8e-4f31-8d53-478fddd88700 @caller=github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2@v2.0.0-beta.26/logger.go:138 aws.sdk=aws-sdk-go http.duration=70 http.response.header.date="Thu, 21 Sep 2023 09:19:43 GMT" timestamp=2023-09-21T10:19:43.191+0100
So the underlying issue was that we didn't have the rds:DescribeAccountAttributes
action on the policy.
In the provider code it first sets up the quota value with the default value
Then, as some quotas are weird and don't report values, the provider attempts to fetch the actual quota and set it if it didn't return an error.
Seems like we need some additional error handling here; if there is a missing IAM permission then it should throw an error rather than just silently swallowing it
Terraform Core Version
1.1.7
AWS Provider Version
2.11.4
Affected Resource(s)
When using the following resource, the first run completes successfully, but the second run attempts to send a request and fails:
A note about my configuration: The service quota is already set to 30 in my AWS account before the first terraform run.
Expected Behavior
Expecting that the second run works exactly like the first run: it recognizes that the service quota change need not be performed.
Actual Behavior
In the first run, I get the following output:
Now, I run terraform again, and get the following error:
Relevant Error/Panic Output Snippet
No response
Terraform Configuration Files
N/A
Steps to Reproduce
Debug Output
No response
Panic Output
No response
Important Factoids
No response
References
No response
Would you like to implement a fix?
None