Skip to content

Commit

Permalink
add randomized suffix to TestAccOrgPolicyCustomConstraint examples (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
c2thorn authored Oct 26, 2023
1 parent db87c12 commit f769255
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions mmv1/products/orgpolicy/CustomConstraint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,19 @@ examples:
- !ruby/object:Provider::Terraform::Examples
name: 'org_policy_custom_constraint_basic'
primary_resource_id: 'constraint'
vars:
policy_name: 'custom.disableGkeAutoUpgrade'
test_vars_overrides:
policy_name: '"custom.tfTestDisableGkeAutoUpgrade" + acctest.RandString(t, 10)'
test_env_vars:
org_id: :ORG_ID
- !ruby/object:Provider::Terraform::Examples
name: 'org_policy_custom_constraint_full'
primary_resource_id: 'constraint'
vars:
policy_name: 'custom.disableGkeAutoUpgrade'
test_vars_overrides:
policy_name: '"custom.tfTestDisableGkeAutoUpgrade" + acctest.RandString(t, 10)'
test_env_vars:
org_id: :ORG_TARGET
parameters:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
resource "google_org_policy_custom_constraint" "<%= ctx[:primary_resource_id] %>" {

name = "custom.disableGkeAutoUpgrade"
name = "<%= ctx[:vars]['policy_name'] %>"
parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>"

action_type = "ALLOW"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
resource "google_org_policy_custom_constraint" "<%= ctx[:primary_resource_id] %>" {

name = "custom.disableGkeAutoUpgrade"
name = "<%= ctx[:vars]['policy_name'] %>"
parent = "organizations/<%= ctx[:test_env_vars]['org_id'] %>"
display_name = "Disable GKE auto upgrade"
description = "Only allow GKE NodePool resource to be created or updated if AutoUpgrade is not enabled where this custom constraint is enforced."
Expand Down

0 comments on commit f769255

Please sign in to comment.