Skip to content

Commit d3ab68d

Browse files
Added Cloud SQL Server with authorized network example (#5756) (#11216)
Signed-off-by: Modular Magician <[email protected]>
1 parent ed9ef83 commit d3ab68d

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

.changelog/5756.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
```release-note:none
2+
```

google/resource_cgc_snippet_generated_test.go

+46
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,52 @@ resource "google_sql_database_instance" "instance" {
144144
`, context)
145145
}
146146

147+
func TestAccCGCSnippet_sqlSqlserverInstanceAuthorizedNetworkExample(t *testing.T) {
148+
t.Parallel()
149+
150+
context := map[string]interface{}{
151+
"random_suffix": randString(t, 10),
152+
}
153+
154+
vcrTest(t, resource.TestCase{
155+
PreCheck: func() { testAccPreCheck(t) },
156+
Providers: testAccProviders,
157+
Steps: []resource.TestStep{
158+
{
159+
Config: testAccCGCSnippet_sqlSqlserverInstanceAuthorizedNetworkExample(context),
160+
},
161+
{
162+
ResourceName: "google_sql_database_instance.default",
163+
ImportState: true,
164+
ImportStateVerify: true,
165+
ImportStateVerifyIgnore: []string{"deletion_protection", "root_password"},
166+
},
167+
},
168+
})
169+
}
170+
171+
func testAccCGCSnippet_sqlSqlserverInstanceAuthorizedNetworkExample(context map[string]interface{}) string {
172+
return Nprintf(`
173+
resource "google_sql_database_instance" "default" {
174+
name = "myinstance%{random_suffix}"
175+
region = "us-central1"
176+
database_version = "SQLSERVER_2017_STANDARD"
177+
root_password = "INSERT-PASSWORD-HERE"
178+
settings {
179+
tier = "db-custom-2-7680"
180+
ip_configuration {
181+
authorized_networks {
182+
name = "Network Name"
183+
value = "192.0.2.0/24"
184+
expiration_time = "3021-11-15T16:19:00.094Z"
185+
}
186+
}
187+
}
188+
deletion_protection = false
189+
}
190+
`, context)
191+
}
192+
147193
func TestAccCGCSnippet_storageNewBucketExample(t *testing.T) {
148194
t.Parallel()
149195

0 commit comments

Comments
 (0)