Skip to content

Commit

Permalink
fixed writing to state (#5186) (#10082)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician committed Sep 15, 2021
1 parent 62e6dfe commit a5e5535
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .changelog/5186.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
platform: fixed a bug in wrongly writing to state when creation failed on `google_organization_policy`
```
3 changes: 1 addition & 2 deletions google/resource_google_organization_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,6 @@ func resourceGoogleOrganizationPolicy() *schema.Resource {
}

func resourceGoogleOrganizationPolicyCreate(d *schema.ResourceData, meta interface{}) error {
d.SetId(fmt.Sprintf("%s/%s", d.Get("org_id"), d.Get("constraint").(string)))

if isOrganizationPolicyUnset(d) {
return resourceGoogleOrganizationPolicyDelete(d, meta)
}
Expand All @@ -184,6 +182,7 @@ func resourceGoogleOrganizationPolicyCreate(d *schema.ResourceData, meta interfa
return err
}

d.SetId(fmt.Sprintf("%s/%s", d.Get("org_id"), d.Get("constraint").(string)))
return resourceGoogleOrganizationPolicyRead(d, meta)
}

Expand Down

0 comments on commit a5e5535

Please sign in to comment.