-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add reference to docs and include policy update test
- Loading branch information
Showing
2 changed files
with
90 additions
and
4 deletions.
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
65 changes: 65 additions & 0 deletions
65
third_party/terraform/tests/resource_compute_organization_security_policy_test.go.erb
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,65 @@ | ||
<% autogen_exception -%> | ||
package google | ||
<% unless version == 'ga' -%> | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/helper/resource" | ||
"github.com/hashicorp/terraform-plugin-sdk/terraform" | ||
) | ||
|
||
func TestAccComputeOrganizationSecurityPolicy_organizationSecurityPolicyUpdateExample(t *testing.T) { | ||
t.Parallel() | ||
|
||
context := map[string]interface{}{ | ||
"org_id": getTestOrgFromEnv(t), | ||
"random_suffix": randString(t, 10), | ||
} | ||
|
||
vcrTest(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
CheckDestroy: testAccCheckComputeOrganizationSecurityPolicyDestroyProducer(t), | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccComputeOrganizationSecurityPolicy_organizationSecurityPolicyUpdatePreExample(context), | ||
}, | ||
{ | ||
ResourceName: "google_compute_organization_security_policy.policy", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
{ | ||
Config: testAccComputeOrganizationSecurityPolicy_organizationSecurityPolicyUpdatePostExample(context), | ||
}, | ||
{ | ||
ResourceName: "google_compute_organization_security_policy.policy", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testAccComputeOrganizationSecurityPolicy_organizationSecurityPolicyUpdatePreExample(context map[string]interface{}) string { | ||
return Nprintf(` | ||
resource "google_compute_organization_security_policy" "policy" { | ||
display_name = "tf-test%{random_suffix}" | ||
parent = "organizations/%{org_id}" | ||
} | ||
`, context) | ||
} | ||
|
||
func testAccComputeOrganizationSecurityPolicy_organizationSecurityPolicyUpdatePostExample(context map[string]interface{}) string { | ||
return Nprintf(` | ||
resource "google_compute_organization_security_policy" "policy" { | ||
display_name = "tf-test%{random_suffix}" | ||
parent = "organizations/%{org_id}" | ||
description = "Updated description." | ||
} | ||
`, context) | ||
} | ||
<% end -%> |