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/aws: Add CORS settings to S3 bucket #3387

Merged
merged 2 commits into from
Oct 28, 2015
Merged

Conversation

kjmkznr
Copy link
Contributor

@kjmkznr kjmkznr commented Oct 2, 2015

This commit is allows to CORS(Cross-Origin Resource Sharing) rule configuration to S3 bucket resource.

resource "aws_s3_bucket" "b" {
    ....
    cors_rule {
        allowed_headers = ["*"]
        allowed_methods = ["PUT","POST"]
        allowed_origins = ["https://s3-website-test.hashicorp.com"]
        expose_headers = ["ETag"]
        max_age_seconds = 3000
    }
    ....
}

@bizenn
Copy link

bizenn commented Oct 21, 2015

👍

5 similar comments
@2matzzz
Copy link

2matzzz commented Oct 21, 2015

👍

@f440
Copy link
Contributor

f440 commented Oct 21, 2015

👍

@yujideveloper
Copy link

👍

@mitto
Copy link

mitto commented Oct 21, 2015

👍

@corrupt952
Copy link

👍

rule["max_age_seconds"] = ruleObject.MaxAgeSeconds
rules = append(rules, rule)
}
d.Set("cors_rule", rules)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we check for errors here? We've found that setting non-primitives, there can be an error and it's best we inspect/log that

if err := d.Set("cors_rule", rules); err != nil {
  //log
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

@catsby
Copy link
Contributor

catsby commented Oct 27, 2015

Hey @kjmkznr – so sorry for the delay! I do have a question regarding removing the CORs rules if we remove the website, but other than that this looks great!

Let me know what you think

@catsby catsby added the waiting-response An issue/pull request is waiting for a response from the community label Oct 27, 2015
@kjmkznr
Copy link
Contributor Author

kjmkznr commented Oct 28, 2015

@catsby
Thanks reviews!

I think, do not need remove CORS rules when website removed.
CORS and website API is independent each other.
We can set CORS rules without website configurations.

@catsby catsby removed the waiting-response An issue/pull request is waiting for a response from the community label Oct 28, 2015
@catsby
Copy link
Contributor

catsby commented Oct 28, 2015

Thanks!

catsby added a commit that referenced this pull request Oct 28, 2015
provider/aws: Add CORS settings to S3 bucket
@catsby catsby merged commit 5cedd64 into hashicorp:master Oct 28, 2015
@kjmkznr
Copy link
Contributor Author

kjmkznr commented Oct 28, 2015

@catsby

Thanks!!

@kjmkznr kjmkznr deleted the s3-cors branch June 7, 2016 12:27
@ghost
Copy link

ghost commented Apr 25, 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 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants