Skip to content

Commit 3f918ea

Browse files
modular-magicianEdward Sun
and
Edward Sun
authored
fix import error for orgpolicy (#8291) (#15132)
Signed-off-by: Modular Magician <[email protected]> Co-authored-by: Edward Sun <[email protected]>
1 parent b792566 commit 3f918ea

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

.changelog/8291.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
org policy: fixed forcing recreation on imported state for `google_org_policy_policy`
3+
```

google/tpgdclresource/orgpolicy_utils.go

+5
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ func ResourceOrgPolicyPolicyCustomImport(d *schema.ResourceData, meta interface{
2626
if err != nil {
2727
return fmt.Errorf("Error constructing id: %s", err)
2828
}
29+
30+
// reset name to match the one from resourceOrgPolicyPolicyRead
31+
if err := d.Set("name", id); err != nil {
32+
return fmt.Errorf("Error setting name: %s", err)
33+
}
2934
d.SetId(id)
3035

3136
return nil

0 commit comments

Comments
 (0)