Skip to content

Commit c15e36f

Browse files
Fix writing to state when creation failed on google_project_organization_policy (#5958) (#11676)
Signed-off-by: Modular Magician <[email protected]>
1 parent fe3f668 commit c15e36f

6 files changed

+19
-14
lines changed

.changelog/5958.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
resourcemanager: fixed a bug in wrongly writing to state when creation failed on `google_project_organization_policy`
3+
```

.goreleaser.yml

+7-4
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,16 @@ checksum:
3535
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
3636
algorithm: sha256
3737
publishers:
38-
- name: upload
38+
- name: hc-releases
3939
checksum: true
4040
signature: true
41-
cmd: hc-releases upload -product {{ .ProjectName }} -version {{ .Version }} -file={{ .ArtifactPath }}={{ .ArtifactName }} -header="x-terraform-protocol-version={{ .Env.PROTOCOL_VERSION }}" -header="x-terraform-protocol-versions={{ .Env.PROTOCOL_VERSIONS }}"
41+
cmd: hc-releases upload-file -header="x-terraform-protocol-version={{ .Env.PROTOCOL_VERSION }}" -header="x-terraform-protocol-versions={{ .Env.PROTOCOL_VERSIONS }}" {{ abs .ArtifactPath }}
4242
env:
43-
- HC_RELEASES_HOST={{ .Env.HC_RELEASES_HOST }}
44-
- HC_RELEASES_KEY={{ .Env.HC_RELEASES_KEY }}
43+
- AWS_DEFAULT_REGION={{ .Env.AWS_DEFAULT_REGION }}
44+
- AWS_REGION={{ .Env.AWS_REGION }}
45+
- AWS_ACCESS_KEY_ID={{ .Env.AWS_ACCESS_KEY_ID }}
46+
- AWS_SECRET_ACCESS_KEY={{ .Env.AWS_SECRET_ACCESS_KEY }}
47+
- AWS_SESSION_TOKEN={{ .Env.AWS_SESSION_TOKEN }}
4548
release:
4649
ids:
4750
- none

.release/release-metadata.hcl

-2
This file was deleted.

google/resource_clouddeploy_target_generated_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ resource "google_clouddeploy_target" "primary" {
123123
name = "tf-test-target%{random_suffix}"
124124
125125
annotations = {
126-
my_third_annotation = "example-annotation-3"
127-
128126
my_second_annotation = "updated-example-annotation-2"
127+
128+
my_third_annotation = "example-annotation-3"
129129
}
130130
131131
description = "updated description"
@@ -156,9 +156,9 @@ resource "google_clouddeploy_target" "primary" {
156156
name = "tf-test-target%{random_suffix}"
157157
158158
annotations = {
159-
my_second_annotation = "updated-example-annotation-2"
160-
161159
my_third_annotation = "example-annotation-3"
160+
161+
my_second_annotation = "updated-example-annotation-2"
162162
}
163163
164164
description = "updated description"

google/resource_google_project_organization_policy.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,17 @@ func resourceProjectOrgPolicyImporter(d *schema.ResourceData, meta interface{})
6060
}
6161

6262
func resourceGoogleProjectOrganizationPolicyCreate(d *schema.ResourceData, meta interface{}) error {
63-
d.SetId(fmt.Sprintf("%s:%s", d.Get("project"), d.Get("constraint")))
64-
6563
if isOrganizationPolicyUnset(d) {
64+
d.SetId(fmt.Sprintf("%s:%s", d.Get("project"), d.Get("constraint")))
6665
return resourceGoogleProjectOrganizationPolicyDelete(d, meta)
6766
}
6867

6968
if err := setProjectOrganizationPolicy(d, meta); err != nil {
7069
return err
7170
}
7271

72+
d.SetId(fmt.Sprintf("%s:%s", d.Get("project"), d.Get("constraint")))
73+
7374
return resourceGoogleProjectOrganizationPolicyRead(d, meta)
7475
}
7576

website/docs/r/clouddeploy_delivery_pipeline.html.markdown

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ resource "google_clouddeploy_delivery_pipeline" "primary" {
3333
name = "pipeline"
3434
3535
annotations = {
36-
my_first_annotation = "example-annotation-1"
37-
3836
my_second_annotation = "example-annotation-2"
37+
38+
my_first_annotation = "example-annotation-1"
3939
}
4040
4141
description = "basic description"

0 commit comments

Comments
 (0)