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

Why does terraform need aws_elasticsearch_domain_policy resource #5059

Closed
ghost opened this issue Jul 3, 2018 · 3 comments
Closed

Why does terraform need aws_elasticsearch_domain_policy resource #5059

ghost opened this issue Jul 3, 2018 · 3 comments
Labels
question A question about existing functionality; most questions are re-routed to discuss.hashicorp.com. service/elasticsearch Issues and PRs that pertain to the elasticsearch service.

Comments

@ghost
Copy link

ghost commented Jul 3, 2018

This issue was originally opened by @wutianchen as hashicorp/terraform#18376. It was migrated here as a result of the provider split. The original body of the issue is below.


We can define access_policy in resource aws_elasticsearch_domain by supplying a policy document, why do we need aws_elasticsearch_domain_policy resource in this case ?

@tomelliff
Copy link
Contributor

tomelliff commented Jul 3, 2018

As discussed in the original issue that led to it being created it allows you to directly interpolate the ARN of the Elasticsearch domain instead of having to build it as is shown in the docs in #4942 (which should be on the website in the next release).

Without providing the ARN of the domain when creating the policy in line you will get a constant diff as AWS helpfully adds the ARN to restrict to just that ES domain and then Terraform detects the diff and removes it.

@bflad bflad added question A question about existing functionality; most questions are re-routed to discuss.hashicorp.com. service/elasticsearch Issues and PRs that pertain to the elasticsearch service. labels Jul 3, 2018
@bflad
Copy link
Contributor

bflad commented Jul 3, 2018

@tomelliff is correct here. While the additional resource is not strictly required for usage, we have found in many cases when dealing with resource policies (e.g. Elasticsearch Domain policies, S3 Bucket policies, ECR Repository policies) that being able to directly reference the appropriate identifier/ARN of the resource itself (only available after resource creation) makes Terraform configurations easier to implement. Having it separated also allows for separate teams to manage each piece of infrastructure. For example, a security team might manage access to an Elasticsearch Domain while a development team manages the actual cluster.

@bflad bflad closed this as completed Jul 3, 2018
@ghost
Copy link
Author

ghost commented Apr 4, 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 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question A question about existing functionality; most questions are re-routed to discuss.hashicorp.com. service/elasticsearch Issues and PRs that pertain to the elasticsearch service.
Projects
None yet
Development

No branches or pull requests

2 participants