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

Resource churn with v4 S3 refactoring #23129

Closed
acdha opened this issue Feb 11, 2022 · 5 comments · Fixed by #23144
Closed

Resource churn with v4 S3 refactoring #23129

acdha opened this issue Feb 11, 2022 · 5 comments · Fixed by #23144
Assignees
Labels
service/s3 Issues and PRs that pertain to the s3 service.
Milestone

Comments

@acdha
Copy link
Contributor

acdha commented Feb 11, 2022

While working through the changes for the S3 refactoring in v4, I noticed two resource classes still report changes after refactoring my code and importing the corresponding resources.

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

Terraform v1.1.5
on darwin_arm64
+ provider registry.terraform.io/hashicorp/archive v2.2.0
+ provider registry.terraform.io/hashicorp/aws v4.0.0
+ provider registry.terraform.io/hashicorp/dns v3.2.1
+ provider registry.terraform.io/hashicorp/external v2.2.0
+ provider registry.terraform.io/hashicorp/http v2.1.0
+ provider registry.terraform.io/hashicorp/local v2.1.0
+ provider registry.terraform.io/hashicorp/null v3.1.0

Affected Resource(s)

  • aws_s3_bucket_acl
  • aws_s3_bucket_lifecycle_configuration

Terraform Configuration Files

resource "aws_s3_bucket_acl" "logs" {
  bucket = aws_s3_bucket.logs.id
  acl    = "log-delivery-write"
}

resource "aws_s3_bucket_lifecycle_configuration" "logs" {
  bucket = aws_s3_bucket.logs.id

  rule {
    id     = "log-expiration"
    status = "Enabled"
    prefix = ""

    transition {
      days          = 30
      storage_class = "STANDARD_IA"
    }

    transition {
      days          = 180
      storage_class = "GLACIER"
    }
  }
}

Expected Behavior

No changes

Actual Behavior

  # aws_s3_bucket_acl.logs will be updated in-place
  ~ resource "aws_s3_bucket_acl" "logs" {
      + acl    = "log-delivery-write"
        id     = "MYPROJECT-development-logs"
        # (1 unchanged attribute hidden)

        # (1 unchanged block hidden)
    }

  # aws_s3_bucket_lifecycle_configuration.logs will be updated in-place
  ~ resource "aws_s3_bucket_lifecycle_configuration" "logs" {
        id     = "MYPROJECT-development-logs"
        # (1 unchanged attribute hidden)

      ~ rule {
            id     = "log-expiration"
            # (1 unchanged attribute hidden)

          - filter {
              - object_size_greater_than = 0 -> null
              - object_size_less_than    = 0 -> null
            }

            # (2 unchanged blocks hidden)
        }
    }

Plan: 0 to add, 2 to change, 0 to destroy.

Steps to Reproduce

  1. terraform plan

References

@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/s3 Issues and PRs that pertain to the s3 service. labels Feb 11, 2022
@YakDriver YakDriver self-assigned this Feb 11, 2022
@anGie44
Copy link
Contributor

anGie44 commented Feb 11, 2022

Hi @acdha , thank you for reporting this issue! Just to get some initial background info and verify one of the imports, when importing the acl resource into state, was the acl value provided in the id as well e.g. MYPROJECT-development-logs,log-delivery-write ?

@acdha
Copy link
Contributor Author

acdha commented Feb 11, 2022

Hi @acdha , thank you for reporting this issue! Just to get some initial background info and verify one of the imports, when importing the acl resource into state, was the acl value provided in the id as well e.g. MYPROJECT-development-logs,log-delivery-write ?

Ooooh, that's probably it — I just imported the resource itself. The documentation template's 3 column breakpoints mean that the end of the resource name is clipped to make room for the side columns and since it imported without an error using the terraform import aws_s3_bucket_acl.example example form I never thought to see if there was more past the end of the bucket identifier.

Screen Shot 2022-02-11 at 12 01 34 PM

@anGie44
Copy link
Contributor

anGie44 commented Feb 11, 2022

understood, thanks for clarifying! the upgrade just shows one example of import for brevity but if needed there are several options documented in https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_acl#import as well

@YakDriver YakDriver removed their assignment Feb 11, 2022
@YakDriver YakDriver removed the needs-triage Waiting for first response or review from a maintainer. label Feb 11, 2022
@YakDriver YakDriver self-assigned this Feb 11, 2022
@github-actions github-actions bot added this to the v4.1.0 milestone Feb 15, 2022
@github-actions
Copy link

This functionality has been released in v4.1.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/s3 Issues and PRs that pertain to the s3 service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants