Skip to content

Commit fef89a8

Browse files
Added Cloud SQL mysql with authorized network example (#5801) (#4118)
Signed-off-by: Modular Magician <[email protected]>
1 parent e603bf3 commit fef89a8

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

.changelog/5801.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
```release-note:none
2+
```

google-beta/resource_cgc_snippet_generated_test.go

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,52 @@ resource "google_sql_database_instance" "default" {
275275
`, context)
276276
}
277277

278+
func TestAccCGCSnippet_sqlMysqlInstanceAuthorizedNetworkExample(t *testing.T) {
279+
t.Parallel()
280+
281+
context := map[string]interface{}{
282+
"deletion_protection": false,
283+
"random_suffix": randString(t, 10),
284+
}
285+
286+
vcrTest(t, resource.TestCase{
287+
PreCheck: func() { testAccPreCheck(t) },
288+
Providers: testAccProviders,
289+
Steps: []resource.TestStep{
290+
{
291+
Config: testAccCGCSnippet_sqlMysqlInstanceAuthorizedNetworkExample(context),
292+
},
293+
{
294+
ResourceName: "google_sql_database_instance.instance",
295+
ImportState: true,
296+
ImportStateVerify: true,
297+
ImportStateVerifyIgnore: []string{"deletion_protection"},
298+
},
299+
},
300+
})
301+
}
302+
303+
func testAccCGCSnippet_sqlMysqlInstanceAuthorizedNetworkExample(context map[string]interface{}) string {
304+
return Nprintf(`
305+
resource "google_sql_database_instance" "instance" {
306+
name = "tf-test-mysql-instance-with-authorized-network%{random_suffix}"
307+
region = "us-central1"
308+
database_version = "MYSQL_5_7"
309+
settings {
310+
tier = "db-f1-micro"
311+
ip_configuration {
312+
authorized_networks {
313+
name = "Network Name"
314+
value = "192.0.2.0/24"
315+
expiration_time = "3021-11-15T16:19:00.094Z"
316+
}
317+
}
318+
}
319+
deletion_protection = "%{deletion_protection}"
320+
}
321+
`, context)
322+
}
323+
278324
func TestAccCGCSnippet_sqlSqlserverInstanceBackupLocationExample(t *testing.T) {
279325
t.Parallel()
280326

0 commit comments

Comments
 (0)