Open geoL86 opened 1 year ago
Voting for Prioritization
Volunteering to Work on This Issue
Still happening with Terraform 1.8.3 and AWS Provider 5.50.0
This can be a really expensive bug. I enabled a storage lens for a set of buckets with a large number of objects and explicitly put enabled = false
into the code with a comment for all paid metrics so that anyone who came along knew not to enable it.
What seems to be happening is that any value passed for enabled results in it being enabled, and only nulling it disables the metrics.
I took a look at the code for the provider and it seems like it is properly setting false on the apiObject
which is a configuration instance from the aws go sdk v2
https://github.com/hashicorp/terraform-provider-aws/blob/v5.14.0/internal/service/s3control/storage_lens_configuration.go#L794-L806
I was wondering if this is a bug in the sdk where the IsEnabled on the objects is not properly honoring but i cannot find any evidence that they are doing anything but bundling it up as a payload and handing it off to AWS.
Either way, until AWS fixes this, I think the correct behavior for the provider is to check if the enabled values are true
and set the config to nil
if enabled is false
.
Hi there, AWS SDK for Go maintainer here 👋
If one of the participants on the thread can isolate the issue using the Go SDK directly, please open a corresponding issue on our repo and we will take a look.
Thanks, Ran~
@RanVaknin I wrote up a proof of concept here https://github.com/ssabo/s3lens_bug_proof/blob/main/main.go
if you replace the temp string in there with the account Id you are running on, it will create a storage lens for the whole account. If you go check the configuration for that storage lens, you will see that the paid metrics are enabled for the cost optimization which is specified as false
in the code. Everything else that is nil
is disabled.
Hi @ssabo ,
Thanks for this. We have identified the issue with the S3Control API model and have submitted an internal ticket to the S3 team to fix it.
Thanks again. Ran~
Terraform Core Version
1.3.5
AWS Provider Version
4.39.0
Affected Resource(s)
aws_s3control_storage_lens_configuration
Expected Behavior
Terraform/Provider doesn't create resource (Storage Lens configuration) with exactly parameters that are presented in code. This applies specifically to the parameters: activity_metrics
For example:
Actual Behavior
Instead, it creates a resource with enabled options and on the next plan indicates what needs to be changed about the code (shows diff). And so in a circle.
Relevant Error/Panic Output Snippet
Terraform Configuration Files
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3control_storage_lens_configuration
Steps to Reproduce
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3control_storage_lens_configuration
Debug Output
No response
Panic Output
No response
Important Factoids
No response
References
No response
Would you like to implement a fix?
No response