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

Plan-time validation if attempting to manage the same physical resource with two Terraform resources #202

Closed
kmoe opened this issue Oct 21, 2019 · 3 comments
Labels
enhancement New feature or request proposal

Comments

@kmoe
Copy link
Member

kmoe commented Oct 21, 2019

For example, consider the aws_s3_bucket_policy resource:

resource "aws_s3_bucket" "b" {
  bucket = "my_tf_test_bucket"
}

resource "aws_s3_bucket_policy" "b" {
  bucket = "${aws_s3_bucket.b.id}"

  policy = ...
}

AWS permits only one bucket policy per bucket, and buckets are individuated by the bucket.id attribute. However, there is nothing to stop us creating multiple aws_s3_bucket_policy resources for the same bucket in our Terraform configuration.

A new schema behaviour, or other plan-time validation, could enforce at most one resource for each value of the specified attribute.

Proposed by @bflad.

@kmoe kmoe added the proposal label Oct 21, 2019
@apparentlymart
Copy link
Contributor

I wrote up some notes on an idea that relates to this in hashicorp/terraform#22094, but that it a larger idea conceptually so if there is a smaller version of it that fits in the SDK itself that'd be great!

@radeksimko radeksimko added the enhancement New feature or request label Oct 22, 2019
@bflad
Copy link
Contributor

bflad commented Nov 6, 2019

I believe this may be the same as #224

@kmoe kmoe added the duplicate label Nov 8, 2019
@kmoe kmoe closed this as completed Nov 8, 2019
@ghost
Copy link

ghost commented Mar 31, 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 Mar 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request proposal
Projects
None yet
Development

No branches or pull requests

4 participants