Skip to content

Commit ef1cbd6

Browse files
modular-magicianEdward Sun
andauthored
fix update failure (#7101) (#5083)
Co-authored-by: Edward Sun <[email protected]> Signed-off-by: Modular Magician <[email protected]> Signed-off-by: Modular Magician <[email protected]> Co-authored-by: Edward Sun <[email protected]>
1 parent c7f463c commit ef1cbd6

File tree

3 files changed

+74
-1
lines changed

3 files changed

+74
-1
lines changed

.changelog/7101.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
bigqueryconnection: fixed `aws.access_role.iam_role_id` cannot be updated on `google_bigquery_connection`
3+
```

google-beta/resource_bigquery_connection.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ func resourceBigqueryConnectionConnectionUpdate(d *schema.ResourceData, meta int
514514
}
515515

516516
if d.HasChange("aws") {
517-
updateMask = append(updateMask, "aws")
517+
updateMask = append(updateMask, "aws.access_role.iam_role_id")
518518
}
519519

520520
if d.HasChange("azure") {

google-beta/resource_bigquery_connection_test.go

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,73 @@ resource "google_bigquery_connection" "connection" {
138138
}
139139
`, context)
140140
}
141+
142+
func TestAccBigqueryConnectionConnection_bigqueryConnectionAwsUpdate(t *testing.T) {
143+
t.Parallel()
144+
145+
context := map[string]interface{}{
146+
"random_suffix": randString(t, 10),
147+
}
148+
149+
vcrTest(t, resource.TestCase{
150+
PreCheck: func() { testAccPreCheck(t) },
151+
Providers: testAccProviders,
152+
ExternalProviders: map[string]resource.ExternalProvider{
153+
"random": {},
154+
"time": {},
155+
},
156+
CheckDestroy: testAccCheckBigqueryConnectionConnectionDestroyProducer(t),
157+
Steps: []resource.TestStep{
158+
{
159+
Config: testAccBigqueryConnectionConnection_bigqueryConnectionAws(context),
160+
},
161+
{
162+
ResourceName: "google_bigquery_connection.connection",
163+
ImportState: true,
164+
ImportStateVerify: true,
165+
ImportStateVerifyIgnore: []string{"location"},
166+
},
167+
{
168+
Config: testAccBigqueryConnectionConnection_bigqueryConnectionAwsUpdate(context),
169+
},
170+
{
171+
ResourceName: "google_bigquery_connection.connection",
172+
ImportState: true,
173+
ImportStateVerify: true,
174+
ImportStateVerifyIgnore: []string{"location"},
175+
},
176+
},
177+
})
178+
}
179+
180+
func testAccBigqueryConnectionConnection_bigqueryConnectionAws(context map[string]interface{}) string {
181+
return Nprintf(`
182+
resource "google_bigquery_connection" "connection" {
183+
connection_id = "tf-test-my-connection%{random_suffix}"
184+
location = "aws-us-east-1"
185+
friendly_name = "👋"
186+
description = "a riveting description"
187+
aws {
188+
access_role {
189+
iam_role_id = "arn:aws:iam::999999999999:role/omnirole%{random_suffix}"
190+
}
191+
}
192+
}
193+
`, context)
194+
}
195+
196+
func testAccBigqueryConnectionConnection_bigqueryConnectionAwsUpdate(context map[string]interface{}) string {
197+
return Nprintf(`
198+
resource "google_bigquery_connection" "connection" {
199+
connection_id = "tf-test-my-connection%{random_suffix}"
200+
location = "aws-us-east-1"
201+
friendly_name = "👋"
202+
description = "a riveting description"
203+
aws {
204+
access_role {
205+
iam_role_id = "arn:aws:iam::999999999999:role/omnirole%{random_suffix}update"
206+
}
207+
}
208+
}
209+
`, context)
210+
}

0 commit comments

Comments
 (0)