-
Notifications
You must be signed in to change notification settings - Fork 0
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
2544 terraform s3 policy #1
Conversation
This reverts commit 0975a70.
…ng as expected currently
+1 |
Did we figure out the unit testing process? Would love to see working unit tests with this before we merge it down. |
@tehnorm They have "acceptance tests" but not "unit tests" the acceptance tests still run, I can work on figuring out how to write more. They appear to be more of an integration type test than a unit test, in that they actually create / destroy live resources on the services. It's going to take at least a day or two of research to understand how to write my own. However, I might be able to get some feedback from hashicorp. that might help. |
s3conn := meta.(*AWSClient).s3conn | ||
bucket := d.Get("bucket").(string) | ||
policy := d.Get("policy").(string) | ||
name := d.Get("name").(string) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I also do not know Go, but would it be possible to give these variables some more descriptive names? What is 'd', for instance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's basically their standard:
https://godoc.org/github.com/hashicorp/terraform/helper/schema#pkg-index
d *ResourceData technically if I was going strictly by their practices I probably should have stuck with m for meta.
I agree it's not very descriptive.
I will probably be closing this in favor of I have been testing it and it seems to have all the same functionality as well as already having tests. |
1992 has already been merged into master on hashicorp. |
Docs for aws_s3_bucket content argument
This code adds a new provider to terraform that allows you to add a Policy to an s3 bucket like this:
resource "aws_s3_bucket_policy" "test_policy" {
name = "Bucket Test Policy"
bucket = "${aws_s3_bucket.b.id}"
policy = <<EOF
{
"Id": "Policy1431447664360",
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1431447659873",
"Action": [
"s3:GetObject"
],
"Effect": "Allow",
"Resource": "arn:aws:s3:::my_tf_test_bucket/",
"Principal": ""
}
]
}
EOF
}