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

provider/google/storage: support for bucket CORS policy #12519

Closed
renchap opened this issue Mar 8, 2017 · 4 comments
Closed

provider/google/storage: support for bucket CORS policy #12519

renchap opened this issue Mar 8, 2017 · 4 comments

Comments

@renchap
Copy link

renchap commented Mar 8, 2017

There is currently no way to set a Google Cloud Storage CORS policy on a bucket.

It is set using the cors[] attribute on a Bucket object: https://cloud.google.com/storage/docs/json_api/v1/buckets

Implementation could be similar to the AWS S3 Bucket resource:

resource "google_storage_bucket" "image-store" {
  name     = "image-store-bucket"
  location = "EU"
  cors_rule {
        response_headers = ["*"]
        allowed_methods = ["PUT","POST"]
        allower_origins = ["https://gcs-website-test.hashicorp.com"]
        response_headers = ["ETag"]
        max_age_seconds = 3000
  }
}
@renchap renchap changed the title provider/google/storage: support for defaultObjectAccessControls provider/google/storage: support for bucket CORS policy Mar 8, 2017
@AVVS
Copy link

AVVS commented Apr 23, 2017

It has a tad different params:

    "origin": Array<string>,
    "responseHeader": Array<string>,
    "method": Array<string>,
    "maxAgeSeconds": int64

However, this would be superb to have, too, otherwise its manual labour :(

@kolpav
Copy link

kolpav commented Apr 30, 2017

Just starting out with terraform and first thing I tried to do is not supported 😄 would be really nice to have it. Please consider adding it.
For anyone searching for temp. solution you can do

// cors-json-file.json
[
    {
      "origin": ["*"],
      "responseHeader": ["Content-Type"],
      "method": ["GET", "HEAD"],
      "maxAgeSeconds": 3600
    }
]
gsutil cors set cors-json-file.json gs://<your-bucket-name>
gsutil cors get gs://<your-bucket-name>

@danawillow
Copy link
Contributor

Fixed in #14695

@ghost
Copy link

ghost commented Apr 11, 2020

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.

@ghost ghost locked and limited conversation to collaborators Apr 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants