-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Finish converting ACM resources to use policy mutex lock #12735
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
39f8dba
Switch over resources that already have an access policy property
coder-221 9029ffd
Change mutex for remaining sub-accessPolicy resources
coder-221 b77f4f2
update comments
coder-221 eeb78ae
end of file new line
coder-221 40b9388
Remove immutable key from accessPolicyId property
coder-221 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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
8 changes: 8 additions & 0 deletions
8
mmv1/templates/terraform/encoders/access_context_manager_access_level_condition.go.tmpl
This file contains 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,8 @@ | ||
// Set the access_policy_id field from part of the access_level parameter. | ||
|
||
// The is logic is inside the encoder since the access_policy_id field is part of | ||
// the mutex lock and encoders run before the lock is set. | ||
parts := strings.Split(d.Get("access_level").(string), "/") | ||
d.Set("access_policy_id", fmt.Sprintf("accessPolicies/%s", parts[1])) | ||
|
||
return obj, nil |
8 changes: 8 additions & 0 deletions
8
mmv1/templates/terraform/encoders/access_context_manager_egress_policy.go.tmpl
This file contains 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,8 @@ | ||
// Set the access_policy_id field from part of the egress_policy_name parameter. | ||
|
||
// The is logic is inside the encoder since the access_policy_id field is part of | ||
// the mutex lock and encoders run before the lock is set. | ||
parts := strings.Split(d.Get("egress_policy_name").(string), "/") | ||
d.Set("access_policy_id", fmt.Sprintf("accessPolicies/%s", parts[1])) | ||
|
||
return obj, nil |
8 changes: 8 additions & 0 deletions
8
mmv1/templates/terraform/encoders/access_context_manager_ingress_policy.go.tmpl
This file contains 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,8 @@ | ||
// Set the access_policy_id field from part of the ingress_policy_name parameter. | ||
|
||
// The is logic is inside the encoder since the access_policy_id field is part of | ||
// the mutex lock and encoders run before the lock is set. | ||
parts := strings.Split(d.Get("ingress_policy_name").(string), "/") | ||
d.Set("access_policy_id", fmt.Sprintf("accessPolicies/%s", parts[1])) | ||
|
||
return obj, nil |
8 changes: 8 additions & 0 deletions
8
...terraform/encoders/access_context_manager_service_perimeter_dry_run_egress_policy.go.tmpl
This file contains 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,8 @@ | ||
// Set the access_policy_id field from part of the perimeter parameter. | ||
|
||
// The is logic is inside the encoder since the access_policy_id field is part of | ||
// the mutex lock and encoders run before the lock is set. | ||
parts := strings.Split(d.Get("perimeter").(string), "/") | ||
d.Set("access_policy_id", fmt.Sprintf("accessPolicies/%s", parts[1])) | ||
|
||
return obj, nil |
8 changes: 8 additions & 0 deletions
8
...erraform/encoders/access_context_manager_service_perimeter_dry_run_ingress_policy.go.tmpl
This file contains 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,8 @@ | ||
// Set the access_policy_id field from part of the perimeter parameter. | ||
|
||
// The is logic is inside the encoder since the access_policy_id field is part of | ||
// the mutex lock and encoders run before the lock is set. | ||
parts := strings.Split(d.Get("perimeter").(string), "/") | ||
d.Set("access_policy_id", fmt.Sprintf("accessPolicies/%s", parts[1])) | ||
|
||
return obj, nil |
8 changes: 8 additions & 0 deletions
8
...ates/terraform/encoders/access_context_manager_service_perimeter_dry_run_resource.go.tmpl
This file contains 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,8 @@ | ||
// Set the access_policy_id field from part of the perimeter_name parameter. | ||
|
||
// The is logic is inside the encoder since the access_policy_id field is part of | ||
// the mutex lock and encoders run before the lock is set. | ||
parts := strings.Split(d.Get("perimeter_name").(string), "/") | ||
d.Set("access_policy_id", fmt.Sprintf("accessPolicies/%s", parts[1])) | ||
|
||
return obj, nil |
8 changes: 8 additions & 0 deletions
8
...mplates/terraform/encoders/access_context_manager_service_perimeter_egress_policy.go.tmpl
This file contains 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,8 @@ | ||
// Set the access_policy_id field from part of the perimeter parameter. | ||
|
||
// The is logic is inside the encoder since the access_policy_id field is part of | ||
// the mutex lock and encoders run before the lock is set. | ||
parts := strings.Split(d.Get("perimeter").(string), "/") | ||
d.Set("access_policy_id", fmt.Sprintf("accessPolicies/%s", parts[1])) | ||
|
||
return obj, nil |
8 changes: 8 additions & 0 deletions
8
...plates/terraform/encoders/access_context_manager_service_perimeter_ingress_policy.go.tmpl
This file contains 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,8 @@ | ||
// Set the access_policy_id field from part of the perimeter parameter. | ||
|
||
// The is logic is inside the encoder since the access_policy_id field is part of | ||
// the mutex lock and encoders run before the lock is set. | ||
parts := strings.Split(d.Get("perimeter").(string), "/") | ||
d.Set("access_policy_id", fmt.Sprintf("accessPolicies/%s", parts[1])) | ||
|
||
return obj, nil |
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.
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.
Why is this field
immutable
andoutput true
at the same time?Can the user set the policyId from their TF config?
This comment also applies for all the cases below.
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.
Output
because the field should never be set by the user. It's a substring automatically parsed from theperimeter
parameter they set (varies slightly across different resources).Ie users are setting a
perimeter
parameter toaccessPolicies/123/servicePerimeters/abc
and we now want the mutex to be the substringaccessPolicies/123
. I want this to be an invisible change for users, so instead of having them input another param we can just parse it from that.Immutable
since theaccessPolicy
can never change once it's set.If there's an easier way to have a mutex lock on a substring of a parameter, please let me know. I was kind of hoping we'd establish the pattern in #12725 and then this PR was just copying that to all other resources, but if we need changes that's fine.
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.
Thanks for the explanation.
If
immutable
is set to true, if there's any modification to this field, another new resource will be recreated. Is that something you'd expect?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.
Ah I think I see what you're saying. I wouldn't want that to trigger a recreate. Really I want the field to be ignored except where I'm reading it in the
pre_create
. I've removed theimmutable
property from all of them but keptoutput
since users should not input data themselves into the property. Thanks for the help!