terraform-aws-modules / terraform-aws-s3-bucket

Terraform module to create AWS S3 resources 🇺🇦

Home Page:https://registry.terraform.io/modules/terraform-aws-modules/s3-bucket/aws

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Module does not track versioning enabled manually

l13t opened this issue · comments

Description

After migration to Terraform AWS provider v4 versioning option has its own resource. In case versioning was enabled manually after bucket creation, it's not visible on the next terraform plan run.

Versions

  • Module version [Required]: v3.6.0

  • Terraform version: v1.3.3

  • Provider version(s): v4.44.0

Reproduction Code [Required]

Example config:

provider "aws" {
  region = "us-east-1"

  # Make it faster by skipping something
  skip_get_ec2_platforms      = true
  skip_metadata_api_check     = true
  skip_region_validation      = true
  skip_credentials_validation = true
  skip_requesting_account_id  = true
}

module "s3_bucket" {
  source = "terraform-aws-modules/s3-bucket/aws"

  bucket = "li-test-s3-version"
  acl    = "private"
}
❯ aws s3api get-bucket-versioning --bucket li-test-s3-version | jq -r
{
  "Status": "Enabled"
}

❯ terraform plan
module.s3_bucket.data.aws_caller_identity.current: Reading...
module.s3_bucket.data.aws_canonical_user_id.this: Reading...
module.s3_bucket.aws_s3_bucket.this[0]: Refreshing state... [id=li-test-s3-version]
module.s3_bucket.data.aws_caller_identity.current: Read complete after 1s [id=***]
module.s3_bucket.data.aws_canonical_user_id.this: Read complete after 1s [id=***]
module.s3_bucket.aws_s3_bucket_public_access_block.this[0]: Refreshing state... [id=li-test-s3-version]
module.s3_bucket.aws_s3_bucket_acl.this[0]: Refreshing state... [id=li-test-s3-version,private]

No changes. Your infrastructure matches the configuration.

Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.

Expected behavior

The module tracks the current state of versioning if it is disabled.

Actual behavior

Manually enabled versioning is not detected as drift.

Terminal Output Screenshot(s)

Additional context

It would be nice to implement such functionality, since we live in a not-ideal world, and in most cases, people are able to change infrastructure manually. I didn't check, but I guess the same issue appears for other resources like lifecycle, etc.

This issue has been automatically marked as stale because it has been open 30 days
with no activity. Remove stale label or comment or this issue will be closed in 10 days

This issue was automatically closed because of stale in 10 days

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.