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

cors_rules.allowed_operations are not stable #74

Open
cinemast opened this issue Aug 1, 2024 · 3 comments
Open

cors_rules.allowed_operations are not stable #74

cinemast opened this issue Aug 1, 2024 · 3 comments

Comments

@cinemast
Copy link

cinemast commented Aug 1, 2024

Hi!

I define a bucket with cors rules using the following:

resource "b2_bucket" "media_bucket" {
  bucket_name = "example-${terraform.workspace}"
  bucket_type = "allPrivate"
  cors_rules {
    allowed_operations = [ "s3_put", "s3_head", "s3_get" ]
    allowed_origins = [ "https://app.${local.env[terraform.workspace].domain}", "http://localhost:5173"]
    cors_rule_name = "example-cors-${terraform.workspace}"
    max_age_seconds = 60
  }
}

It updates as expected, however, if I run again using terraform apply I again get the same change suggested

resource "b2_bucket" "media_bucket" {
        id          = "<id>"
        # (7 unchanged attributes hidden)

      ~ cors_rules {
          ~ allowed_operations = [
              - "s3_head",
                "s3_put",
              + "s3_head",
                "s3_get",
            ]
            # (5 unchanged attributes hidden)
        }

        # (2 unchanged blocks hidden)
    }

Which should be a no-op.

@vbaltrusaitis-reef
Copy link
Collaborator

vbaltrusaitis-reef commented Aug 7, 2024

Thank you for the report. I can reproduce the problem and will work on fixing it. In the meantime, as a workaround you can reorder allowed_operations to [ "s3_head", "s3_put", "s3_get" ], terraform will not report needing to change the state then.

@cinemast
Copy link
Author

cinemast commented Aug 7, 2024

I tried that already, sadly with the same result.

@cinemast
Copy link
Author

Any chance you could craft a release for this fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants