Skip to content

Commit

Permalink
Code review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
josemanuelt committed May 23, 2018
1 parent 4722e12 commit 8fb6670
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 48 deletions.
4 changes: 2 additions & 2 deletions google/resource_google_folder_organization_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func setFolderOrganizationPolicy(d *schema.ResourceData, meta interface{}) error
return err
}

restore_default, err := expandRestoreOrganizationPolicy(d.Get("restore_policy").([]interface{}))
restoreDefault, err := expandRestoreOrganizationPolicy(d.Get("restore_policy").([]interface{}))
if err != nil {
return err
}
Expand All @@ -102,7 +102,7 @@ func setFolderOrganizationPolicy(d *schema.ResourceData, meta interface{}) error
Constraint: canonicalOrgPolicyConstraint(d.Get("constraint").(string)),
BooleanPolicy: expandBooleanOrganizationPolicy(d.Get("boolean_policy").([]interface{})),
ListPolicy: listPolicy,
RestoreDefault: restore_default,
RestoreDefault: restoreDefault,
Version: int64(d.Get("version").(int)),
Etag: d.Get("etag").(string),
},
Expand Down
8 changes: 4 additions & 4 deletions google/resource_google_organization_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,17 +249,17 @@ func flattenBooleanOrganizationPolicy(policy *cloudresourcemanager.BooleanPolicy
}

func flattenRestoreOrganizationPolicy(restore_policy *cloudresourcemanager.RestoreDefault) []map[string]interface{} {
bRestore_policy := make([]map[string]interface{}, 0, 1)
rp := make([]map[string]interface{}, 0, 1)

if restore_policy == nil {
return bRestore_policy
return rp
}

bRestore_policy = append(bRestore_policy, map[string]interface{}{
rp = append(rp, map[string]interface{}{
"default": true,
})

return bRestore_policy
return rp
}

func expandBooleanOrganizationPolicy(configured []interface{}) *cloudresourcemanager.BooleanPolicy {
Expand Down
78 changes: 39 additions & 39 deletions google/resource_google_organization_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,44 +316,44 @@ func getGoogleOrganizationPolicyTestResource(s *terraform.State, n string) (*clo
func testAccOrganizationPolicyConfig_boolean(org string, enforced bool) string {
return fmt.Sprintf(`
resource "google_organization_policy" "bool" {
org_id = "%s"
constraint = "constraints/compute.disableSerialPortAccess"
org_id = "%s"
constraint = "constraints/compute.disableSerialPortAccess"
boolean_policy {
enforced = %t
}
boolean_policy {
enforced = %t
}
}
`, org, enforced)
}

func testAccOrganizationPolicyConfig_list_allowAll(org string) string {
return fmt.Sprintf(`
resource "google_organization_policy" "list" {
org_id = "%s"
constraint = "constraints/serviceuser.services"
list_policy {
allow {
all = true
}
}
org_id = "%s"
constraint = "constraints/serviceuser.services"
list_policy {
allow {
all = true
}
}
}
`, org)
}

func testAccOrganizationPolicyConfig_list_allowSome(org, project string) string {
return fmt.Sprintf(`
resource "google_organization_policy" "list" {
org_id = "%s"
constraint = "constraints/compute.trustedImageProjects"
list_policy {
allow {
values = [
"projects/%s",
"projects/debian-cloud"
]
}
org_id = "%s"
constraint = "constraints/compute.trustedImageProjects"
list_policy {
allow {
values = [
"projects/%s",
"projects/debian-cloud"
]
}
}
}
`, org, project)
Expand All @@ -362,30 +362,30 @@ resource "google_organization_policy" "list" {
func testAccOrganizationPolicyConfig_list_denySome(org string) string {
return fmt.Sprintf(`
resource "google_organization_policy" "list" {
org_id = "%s"
constraint = "serviceuser.services"
list_policy {
deny {
values = [
"doubleclicksearch.googleapis.com",
"replicapoolupdater.googleapis.com",
]
}
}
org_id = "%s"
constraint = "serviceuser.services"
list_policy {
deny {
values = [
"doubleclicksearch.googleapis.com",
"replicapoolupdater.googleapis.com",
]
}
}
}
`, org)
}

func testAccOrganizationPolicyConfig_restore_defaultTrue(org string) string {
return fmt.Sprintf(`
resource "google_organization_policy" "restore" {
org_id = "%s"
constraint = "serviceuser.services"
org_id = "%s"
constraint = "serviceuser.services"
restore_policy {
default = true
}
restore_policy {
default = true
}
}
`, org)
}
6 changes: 3 additions & 3 deletions google/resource_google_project_organization_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,9 @@ resource "google_project_organization_policy" "restore" {
project = "%s"
constraint = "constraints/serviceuser.services"
restore_policy {
default = true
}
restore_policy {
default = true
}
}
`, pid)
}
Expand Down

0 comments on commit 8fb6670

Please sign in to comment.