terraform-provider-aws icon indicating copy to clipboard operation
terraform-provider-aws copied to clipboard

[Bug]: Provider doesn't properly set/store S3 Storage Lens configuration

Open geoL86 opened this issue 2 years ago • 2 comments

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:

resource "aws_s3control_storage_lens_configuration" "organization_dashboard" {
  config_id = "organization-dashboard"
  storage_lens_configuration {
    enabled = true
    aws_org {
      arn = data.aws_organizations_organization.current.arn
    }
    account_level {
      activity_metrics {
        enabled = false
      }
      bucket_level {
        activity_metrics {
          enabled = false
        }
      }
    }
    data_export {
      cloud_watch_metrics {
        enabled = false
      }
    }
  }
}

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 will perform the following actions:

  # aws_s3control_storage_lens_configuration.organization_dashboard will be updated in-place
  ~ resource "aws_s3control_storage_lens_configuration" "organization_dashboard" {
        id         = "123456789012:organization-dashboard"
        tags       = {}
        # (4 unchanged attributes hidden)

      ~ storage_lens_configuration {
            # (1 unchanged attribute hidden)

          ~ account_level {
              ~ activity_metrics {
                  ~ enabled = true -> false
                }

              ~ bucket_level {
                  ~ activity_metrics {
                      ~ enabled = true -> false
                    }
                }
            }

            # (2 unchanged blocks hidden)
        }
    }

  # module.notify_slack.module.lambda.null_resource.archive[0] must be replaced
-/+ resource "null_resource" "archive" {
      ~ id       = "8627681441491886041" -> (known after apply)
      ~ triggers = { # forces replacement
          ~ "timestamp" = "1668775414118395000" -> "1669106538902097000"
            # (1 unchanged element hidden)
        }
    }

Plan: 1 to add, 1 to change, 1 to destroy.

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

geoL86 avatar Nov 22 '22 08:11 geoL86