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

data source for aws_s3_bucket please #1262

Closed
gtmtech opened this issue Jul 27, 2017 · 9 comments
Closed

data source for aws_s3_bucket please #1262

gtmtech opened this issue Jul 27, 2017 · 9 comments
Labels
new-data-source Introduces a new data source.

Comments

@gtmtech
Copy link

gtmtech commented Jul 27, 2017

Terraform 0.9.8

Strange that there is a data source for aws_s3_bucket_object but not one for aws_s3_bucket yet...

Thanks!

@radeksimko radeksimko added the new-data-source Introduces a new data source. label Jul 28, 2017
@radeksimko
Copy link
Member

Hi @gtmtech
do you mind sharing a use-case for this particular potential data source?

Thanks.

@radeksimko radeksimko added the waiting-response Maintainers are waiting on response from community or contributor. label Jul 28, 2017
@gtmtech
Copy link
Author

gtmtech commented Aug 2, 2017

Sure @radeksimko ...

In a security-segregated terraform setup, one team should be responsible for all (or a subset of)
aws policies. This includes IAM policies, KMS policies, and Bucket policies. This team should therefore either be in charge of buckets + bucket policies, or just the policies. Because policy is an attribute on bucket, they need to be in charge of buckets & bucket policies, and therefore they manage the aws_s3_bucket resource.

Another team is a user of the bucket. They wish to manage a DNS entry for a static website to that bucket. They wish to create an aws_route53_record , type=A, with alias{} section referencing name, zone_id of the bucket. These are available through parameters website_domain, and hosted_zone_id on the bucket resource, however they cannot create a datasource to the aws_s3_bucket in order to work out what these parameters are. They end up having to hardcode values as a workaround which is bad.

Modules does not solve this BTW, because in a security-segregated environment, the second team does not have the credentials to refresh the resources in the modules/submodules for good security practice- i.e. the second team is not entitled to know what the policies are on the buckets, kms keys, iam roles, they just have to work under them.

@gtmtech
Copy link
Author

gtmtech commented Aug 2, 2017

Or you can just ignore all the security stuff above, and just say - from the teams perspective there is a bucket not managed by terraform, for which they wish to create a corresponding aws_route53_record resource object pointing to that bucket - in order to do so , they want a datasource to be able to read attributes of that bucket

@radeksimko
Copy link
Member

Doesn't shared remote state solve this problem also?

https://www.terraform.io/docs/providers/terraform/d/remote_state.html

@gtmtech
Copy link
Author

gtmtech commented Aug 16, 2017

No, it requires access to the remote state which would not be available due to security restrictions. E.g. team A has given team B permission to s3:Get* and s3:List* on bucket X, so a data resource would be able to retrieve the bucket attributes that might be useful in setting up a route53_record. However, team A has obviously not given team B permission to see team A's statefile which is full of passwords and sensitive information.

But in any case, if thats the answer, why have any data sources at all? There are loads of useful ones, instances, volumes, odd that bucket is not in the list.

@radeksimko radeksimko removed the waiting-response Maintainers are waiting on response from community or contributor. label Aug 17, 2017
@radeksimko
Copy link
Member

I see, state file might have too much context - that's a reasonable worry and reason for having such data source.

@rgardam
Copy link

rgardam commented Aug 18, 2017

I was just looking for exactly this today. I find it strange that there's an s3_object datasource, but no bucket datasource

@radeksimko
Copy link
Member

#1505 was merged and is part of the recent release 1.1.0

@ghost
Copy link

ghost commented Apr 10, 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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
new-data-source Introduces a new data source.
Projects
None yet
Development

No branches or pull requests

3 participants