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

Add org_policy_custom_constraint resource #6608

Merged
merged 8 commits into from Sep 30, 2022

Conversation

roaks3
Copy link
Contributor

@roaks3 roaks3 commented Sep 27, 2022

Adds the org_policy_custom_constraint resource.

This feature is in public preview, so it will be released under the beta version of the provider. Note that there already exists an org_policy_policy resource that is implemented using the DCL.

b/243447088

Example:

resource "google_org_policy_custom_constraint" "constraint" {
  name         = "organizations/123/customConstraints/custom.disableGkeAutoUpgrade"
  parent       = "organizations/123"

  action_type    = "ALLOW"
  condition      = "resource.management.autoUpgrade == false"
  method_types   = ["CREATE", "UPDATE"]
  resource_types = ["container.googleapis.com/NodePool"]
}

If this PR is for Terraform, I acknowledge that I have:

  • Searched through the issue tracker for an open issue that this either resolves or contributes to, commented on it to claim it, and written "fixes {url}" or "part of {url}" in this PR description. If there were no relevant open issues, I opened one and commented that I would like to work on it (not necessary for very small changes).
  • Generated Terraform, and ran make test and make lint to ensure it passes unit and linter tests.
  • Ensured that all new fields I added that can be set by a user appear in at least one example (for generated resources) or third_party test (for handwritten resources or update tests).
  • Ran relevant acceptance tests (If the acceptance tests do not yet pass or you are unable to run them, please let your reviewer know).
  • Read the Release Notes Guide before writing my release note below.

Release Note Template for Downstream PRs (will be copied)

google_org_policy_custom_constraint

mmv1/products/orgpolicy/api.yaml Show resolved Hide resolved
mmv1/products/orgpolicy/api.yaml Show resolved Hide resolved
@@ -0,0 +1,5 @@
## product level overrides
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lets us implement orgpolicy endpoints with both MMV1 and DCL.

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 2 files changed, 219 insertions(+))
Terraform Beta: Diff ( 8 files changed, 883 insertions(+), 14 deletions(-))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2184
Passed tests 1942
Skipped tests: 238
Failed tests: 4

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests
TestAccOrgPolicyCustomConstraint_update|TestAccOrgPolicyCustomConstraint_orgPolicyCustomConstraintExample|TestAccComputeInstance_soleTenantNodeAffinities|TestAccCGCSnippet_eventarcWorkflowsExample

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccOrgPolicyCustomConstraint_update[Debug log]

Tests failed during RECORDING mode:
TestAccOrgPolicyCustomConstraint_orgPolicyCustomConstraintExample[Error message] [Debug log]
TestAccComputeInstance_soleTenantNodeAffinities[Error message] [Debug log]
TestAccCGCSnippet_eventarcWorkflowsExample[Error message] [Debug log]

Please fix these to complete your PR
View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 2 files changed, 122 insertions(+))
Terraform Beta: Diff ( 8 files changed, 883 insertions(+), 14 deletions(-))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2185
Passed tests 1944
Skipped tests: 239
Failed tests: 2

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests
TestAccComputeInstance_soleTenantNodeAffinities|TestAccOrgPolicyCustomConstraint_orgPolicyCustomConstraintExample

@modular-magician
Copy link
Collaborator

Tests failed during RECORDING mode:
TestAccComputeInstance_soleTenantNodeAffinities[Error message] [Debug log]
TestAccOrgPolicyCustomConstraint_orgPolicyCustomConstraintExample[Error message] [Debug log]

Please fix these to complete your PR
View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 2 files changed, 124 insertions(+))
Terraform Beta: Diff ( 8 files changed, 887 insertions(+), 14 deletions(-))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2185
Passed tests 1942
Skipped tests: 239
Failed tests: 4

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests
TestAccFirebaserulesRelease_BasicRelease|TestAccComputeInstance_soleTenantNodeAffinities|TestAccCGCSnippet_eventarcWorkflowsExample|TestAccOrgPolicyCustomConstraint_orgPolicyCustomConstraintExample

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccFirebaserulesRelease_BasicRelease[Debug log]
TestAccOrgPolicyCustomConstraint_orgPolicyCustomConstraintExample[Debug log]

Tests failed during RECORDING mode:
TestAccComputeInstance_soleTenantNodeAffinities[Error message] [Debug log]
TestAccCGCSnippet_eventarcWorkflowsExample[Error message] [Debug log]

Please fix these to complete your PR
View the build log or the debug log for each test

Copy link
Member

@rileykarson rileykarson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good- few open ended questions on my end, inline.

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 2 files changed, 155 insertions(+))
Terraform Beta: Diff ( 8 files changed, 954 insertions(+), 14 deletions(-))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

Copy link
Member

@rileykarson rileykarson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple minor things on the documentation for parent/name and the example, LGTM otherwise! Assuming tests pass & all.

mmv1/products/orgpolicy/api.yaml Outdated Show resolved Hide resolved
mmv1/products/orgpolicy/api.yaml Outdated Show resolved Hide resolved
mmv1/products/orgpolicy/api.yaml Outdated Show resolved Hide resolved
@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2196
Passed tests 1950
Skipped tests: 240
Failed tests: 6

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests
TestAccOrgPolicyCustomConstraint_update|TestAccOrgPolicyCustomConstraint_orgPolicyCustomConstraintFullExample|TestAccOrgPolicyCustomConstraint_orgPolicyCustomConstraintBasicExample|TestAccComputeInstance_soleTenantNodeAffinities|TestAccFirebaserulesRelease_BasicRelease|TestAccDataSourceGoogleServiceAccountIdToken_impersonation

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccOrgPolicyCustomConstraint_update[Debug log]
TestAccOrgPolicyCustomConstraint_orgPolicyCustomConstraintFullExample[Debug log]
TestAccOrgPolicyCustomConstraint_orgPolicyCustomConstraintBasicExample[Debug log]
TestAccFirebaserulesRelease_BasicRelease[Debug log]
TestAccDataSourceGoogleServiceAccountIdToken_impersonation[Debug log]

Tests failed during RECORDING mode:
TestAccComputeInstance_soleTenantNodeAffinities[Error message] [Debug log]

Please fix these to complete your PR
View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 2 files changed, 153 insertions(+))
Terraform Beta: Diff ( 8 files changed, 950 insertions(+), 14 deletions(-))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2196
Passed tests 1953
Skipped tests: 240
Failed tests: 3

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests
TestAccOrgPolicyCustomConstraint_orgPolicyCustomConstraintBasicExample|TestAccFirebaserulesRelease_BasicRelease|TestAccComputeInstance_soleTenantNodeAffinities

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccOrgPolicyCustomConstraint_orgPolicyCustomConstraintBasicExample[Debug log]
TestAccFirebaserulesRelease_BasicRelease[Debug log]

Tests failed during RECORDING mode:
TestAccComputeInstance_soleTenantNodeAffinities[Error message] [Debug log]

Please fix these to complete your PR
View the build log or the debug log for each test

@roaks3 roaks3 merged commit e6985ae into main Sep 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants