Skip to content

Commit 72f0f99

Browse files
Added Cloud SQL flag examples (#5943) (#4237)
* Added Cloud SQL flags and user examples * Changed name to id to fix Reference to undeclared resource error * fixed references * fixed flags * Removed the user part because it's causing errors Signed-off-by: Modular Magician <[email protected]>
1 parent 84b1e19 commit 72f0f99

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

.changelog/5943.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: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,58 @@ resource "google_sql_database_instance" "instance" {
570570
`, context)
571571
}
572572

573+
func TestAccCGCSnippet_sqlSqlserverInstanceFlagsExample(t *testing.T) {
574+
t.Parallel()
575+
576+
context := map[string]interface{}{
577+
"deletion_protection": false,
578+
"random_suffix": randString(t, 10),
579+
}
580+
581+
vcrTest(t, resource.TestCase{
582+
PreCheck: func() { testAccPreCheck(t) },
583+
Providers: testAccProviders,
584+
Steps: []resource.TestStep{
585+
{
586+
Config: testAccCGCSnippet_sqlSqlserverInstanceFlagsExample(context),
587+
},
588+
{
589+
ResourceName: "google_sql_database_instance.instance",
590+
ImportState: true,
591+
ImportStateVerify: true,
592+
ImportStateVerifyIgnore: []string{"deletion_protection", "root_password"},
593+
},
594+
},
595+
})
596+
}
597+
598+
func testAccCGCSnippet_sqlSqlserverInstanceFlagsExample(context map[string]interface{}) string {
599+
return Nprintf(`
600+
resource "google_sql_database_instance" "instance" {
601+
name = "tf-test-sqlserver-instance%{random_suffix}"
602+
region = "us-central1"
603+
database_version = "SQLSERVER_2019_STANDARD"
604+
root_password = "INSERT-PASSWORD-HERE"
605+
settings {
606+
database_flags {
607+
name = "1204"
608+
value = "on"
609+
}
610+
database_flags {
611+
name = "remote access"
612+
value = "on"
613+
}
614+
database_flags {
615+
name = "remote query timeout (s)"
616+
value = "300"
617+
}
618+
tier = "db-custom-2-7680"
619+
}
620+
deletion_protection = "%{deletion_protection}"
621+
}
622+
`, context)
623+
}
624+
573625
func TestAccCGCSnippet_storageNewBucketExample(t *testing.T) {
574626
t.Parallel()
575627

0 commit comments

Comments
 (0)