generated from masterpointio/terraform-module-template
-
Notifications
You must be signed in to change notification settings - Fork 3
feat: ability to assign AWS integration by name instead of ID only, and add TF Check blocks for mutual exclusivity #92
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
9821e02
feat: resolve & translate aws integration name to ID value
oycyc cedf9c2
feat: resolve & translate aws integration name to ID value
oycyc 6238cef
feat: resolve & translate aws integration name to ID value
oycyc f7abe34
feat: terraform check blocks to check mutual exclusivity between reso…
oycyc f69a937
feat: variable descriptions to document about uniqueness in names && …
oycyc deefafe
feat: rename to be consistent, resource_id_resolver
oycyc 2cfca0e
feat: add comments on describing the resolver
oycyc 061daaf
feat: add comments on describing the resolver
oycyc 8317b2f
Merge branch 'main' into feat/aws-integration-name-resolver-id
oycyc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| /* | ||
| * These check blocks assertions enforce mutual exclusivity between ID and name variables. | ||
| * | ||
| * It took a bit for me to understand the logic, so here's an explanation (with the help with AI): | ||
| * The condition "var.x_id == null || var.x_name == null" is an ASSERTION that must be TRUE. | ||
| * It asserts: "space_id must be null OR space_name must be null" (at least one must be null). | ||
| * | ||
| * When both are set: space_id is NOT null AND space_name is NOT null | ||
| * → false || false = false → ASSERTION FAILS → TF fails (so BOTH shouldn't be set at the same time) | ||
| * | ||
| * When only one is set: one is null, one is not null | ||
| * → true || false = true → ASSERTION PASSES → TF continues (so one can be set, the other can be null) | ||
| * | ||
| * Truth Table: | ||
| * | x_id | x_name | Condition Result | TF Action | | ||
| * |-----------|-------------|-------------------------|------------------| | ||
| * | null | null | true || true = true | ✅ PASS | | ||
| * | null | "some-name" | true || false = true | ✅ PASS | | ||
| * | "some-id" | null | false || true = true | ✅ PASS | | ||
| * | "some-id" | "some-name" | false || false = false | ❌ FAIL | | ||
| */ | ||
|
|
||
| check "spaces_enforce_exclusivity" { | ||
| assert { | ||
| condition = var.space_id == null || var.space_name == null | ||
| error_message = "space_id and space_name are mutually exclusive." | ||
| } | ||
| } | ||
|
|
||
| check "worker_pools_mutual_exclusivity" { | ||
| assert { | ||
| condition = var.worker_pool_id == null || var.worker_pool_name == null | ||
| error_message = "worker_pool_id and worker_pool_name are mutually exclusive." | ||
| } | ||
| } | ||
|
|
||
| check "aws_integrations_mutual_exclusivity" { | ||
| assert { | ||
| condition = var.aws_integration_id == null || var.aws_integration_name == null | ||
| error_message = "aws_integration_id and aws_integration_name are mutually exclusive." | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.