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

S3 bucket issue: Can't configure a value for "versioning": its value will be decided automatically based on the result of applying this configuration. #23125

Closed
amamidwar opened this issue Feb 11, 2022 · 15 comments
Labels
service/s3 Issues and PRs that pertain to the s3 service.

Comments

@amamidwar
Copy link

Terraform CLI and Terraform AWS Provider Version

terraform script is failing with below error which is running in the provider version : 3.74.1. I have done no change in code base since last 1 year. Facing issue with new release version 4.0.0

Affected Resource(s)

  • aws_s3_bucket

Terraform Configuration Files

Code:

resource "aws_s3_bucket" "secondarybucket" {
  bucket    = "${var.tId}.replicated.${var.Name}"
  provider  = aws.secondary
  force_destroy = true

  versioning {
    enabled = true
  }

Debug Output

Panic Output

 Error: Value for unconfigurable attribute
│
│   with module.buckets.aws_s3_bucket.secondarybucket,
│   on ../modules/terraform-aws-s3buckets/main.tf line 100, in resource "aws_s3_bucket" "secondarybucket":
│  100: resource "aws_s3_bucket" "secondarybucket" {
│
│ Can't configure a value for "versioning": its value will be decided automatically based on the result of applying this configuration.

Expected Behavior

Actual Behavior

Terraform applies policy successfully. And create s3 buckets.

Steps to Reproduce

  1. terraform apply

Important Factoids

References

  • #0000
@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
@ksemtinimahmoud
Copy link

The versioning argument is read-only as of version 4.0 of the Terraform AWS Provider. See the aws_s3_bucket_versioning resource for configuration details.

@diseku
Copy link

diseku commented Feb 11, 2022

is there any kind of pre-release mailing list in order not to get the surprises like this?
i understand, that the other option would be to pin the provider version, but for most of the users it is combined with a lot of overhead

@scott-doyland-burrows
Copy link
Contributor

I am getting multiple errors:

Error: Value for unconfigurable attribute
│
│   with aws_s3_bucket.aws_s3_bucket,
│   on main.tf line 1, in resource "aws_s3_bucket" "aws_s3_bucket":
│    1: resource "aws_s3_bucket" "aws_s3_bucket" {
│
│ Can't configure a value for "versioning": its value will be decided automatically based on the result of applying this configuration.
╵
╷
│ Error: Value for unconfigurable attribute
│
│   with aws_s3_bucket.aws_s3_bucket,
│   on main.tf line 1, in resource "aws_s3_bucket" "aws_s3_bucket":
│    1: resource "aws_s3_bucket" "aws_s3_bucket" {
│
│ Can't configure a value for "server_side_encryption_configuration": its value will be decided automatically based on the result of applying this configuration.
╵
╷
│ Error: Value for unconfigurable attribute
│
│   with aws_s3_bucket.aws_s3_bucket,
│   on main.tf line 4, in resource "aws_s3_bucket" "aws_s3_bucket":
│    4:   acl           = var.s3bucket_acl
│
│ Can't configure a value for "acl": its value will be decided automatically based on the result of applying this configuration.

@tarunptala
Copy link

yes we also experiencing this ...looks like it started post release version 4.0.0

@diseku
Copy link

diseku commented Feb 11, 2022

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/guides/version-4-upgrade#s3-bucket-refactor

@erikpaasonen
Copy link
Contributor

for anyone impacted by this, it might be worth upvoting this issue: #23106 👍

@jwyoungpm
Copy link

Saying "use terraform import" puts those with hundreds of buckets in a tough spot.

@ghost
Copy link

ghost commented Feb 11, 2022

It should be noted that I counted ~12/13 possible arguments that may require running terraform import in order to refactor to support 4.x.

Some fun math for you, if you have 100 buckets you need to refactor, and you use a bunch of the various configuration (versioning, logging, acls, etc.) you're looking at potentially 700+ terraform import commands needed. This is all the while also coordinating the next release/apply of your TF infrastructure module version including the proper new resources to avoid running into errors/etc. :)

@tarunptala
Copy link

we were able to temporary fix this by pinning module to exact last working version of provider.

required_providers {
    aws = "~> 3.74"
  }

@spanktar
Copy link

Holy carp, they can't seriously think that this is an acceptable path forward.

@UdhavPawar
Copy link

we were able to temporary fix this by pinning module to exact last working version of provider.

required_providers {
    aws = "~> 3.74"
  }

Props to @tarunptala for this one. Verified work-around works great till this issue is fixed.

@justinretzolk
Copy link
Member

Hey y'all 👋 Thank you for taking the time to raise this, and for the discussion around it. It looks like this is a duplicate (to some degree; it's slightly different, but has the same root cause) of #23106. We like to keep discussions centralized where possible, so we'll close this one in favor of #23106 for now. If you feel we've done this in error, please do let us know.

@Dawn-W
Copy link

Dawn-W commented Mar 21, 2022

@panchamsheoran77
Copy link

panchamsheoran77 commented Mar 29, 2022

Since versioning is now read only, update your configuration to use the aws_s3_bucket_versioning resource and remove versioning and its nested arguments in the aws_s3_bucket resource:
as mentioned in document
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/guides/version-4-upgrade
like this :

resource "aws_s3_bucket" "example" {
  bucket = "yournamehere"

   ... other configuration ...
}

resource "aws_s3_bucket_versioning" "example" {
  bucket = aws_s3_bucket.example.id
  versioning_configuration {
    status = "Enabled"
  }
}

@github-actions
Copy link

github-actions bot commented May 5, 2022

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 5, 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

No branches or pull requests