Skip to content

Commit

Permalink
Added Cloud SQL SSL/TLS example (#5980) (#11583)
Browse files Browse the repository at this point in the history
* Added Cloud SQL SSL/TLS example

* Added skip test true to multiple examples

* Added missing primary resource type

Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician authored Apr 25, 2022
1 parent d299707 commit 041589c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 210 deletions.
2 changes: 2 additions & 0 deletions .changelog/5980.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
```release-note:none
```
210 changes: 0 additions & 210 deletions google/resource_cgc_snippet_generated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -622,83 +622,6 @@ resource "google_sql_database_instance" "instance" {
`, context)
}

func TestAccCGCSnippet_sqlInstanceHaExample(t *testing.T) {
t.Parallel()

context := map[string]interface{}{
"deletion_protection": false,
"random_suffix": randString(t, 10),
}

vcrTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccCGCSnippet_sqlInstanceHaExample(context),
},
{
ResourceName: "google_sql_database_instance.default",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"deletion_protection", "root_password"},
},
},
})
}

func testAccCGCSnippet_sqlInstanceHaExample(context map[string]interface{}) string {
return Nprintf(`
resource "google_sql_database_instance" "mysql_instance_ha" {
name = "tf-test-mysql-instance-ha%{random_suffix}"
region = "asia-northeast1"
database_version = "MYSQL_8_0"
settings {
tier = "db-f1-micro"
availability_type = "REGIONAL"
backup_configuration {
enabled = true
binary_log_enabled = true
start_time = "20:55"
}
}
deletion_protection = "%{deletion_protection}"
}
resource "google_sql_database_instance" "postgres_instance_ha" {
name = "tf-test-postgres-instance-ha%{random_suffix}"
region = "us-central1"
database_version = "POSTGRES_14"
settings {
tier = "db-custom-2-7680"
availability_type = "REGIONAL"
backup_configuration {
enabled = true
point_in_time_recovery_enabled = true
start_time = "20:55"
}
}
deletion_protection = "%{deletion_protection}"
}
resource "google_sql_database_instance" "default" {
name = "tf-test-sqlserver-instance-ha%{random_suffix}"
region = "us-central1"
database_version = "SQLSERVER_2019_STANDARD"
root_password = "INSERT-PASSWORD-HERE"
settings {
tier = "db-custom-2-7680"
availability_type = "REGIONAL"
backup_configuration {
enabled = true
start_time = "20:55"
}
}
deletion_protection = "%{deletion_protection}"
}
`, context)
}

func TestAccCGCSnippet_sqlInstanceCmekExample(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -790,139 +713,6 @@ resource "google_sql_database_instance" "default" {
`, context)
}

func TestAccCGCSnippet_sqlInstanceLabelsExample(t *testing.T) {
t.Parallel()

context := map[string]interface{}{
"deletion_protection": false,
"random_suffix": randString(t, 10),
}

vcrTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccCGCSnippet_sqlInstanceLabelsExample(context),
},
{
ResourceName: "google_sql_database_instance.default",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"deletion_protection", "root_password"},
},
},
})
}

func testAccCGCSnippet_sqlInstanceLabelsExample(context map[string]interface{}) string {
return Nprintf(`
resource "google_sql_database_instance" "mysql_instance_labels" {
name = "tf-test-mysql-instance-labels%{random_suffix}"
region = "us-central1"
database_version = "MYSQL_8_0"
settings {
tier = "db-n1-standard-2"
user_labels = {
track = "production"
billing-code = 34802
}
}
deletion_protection = "false"
}
resource "google_sql_database_instance" "postgres_instance_labels" {
name = "tf-test-postgres-instance-labels%{random_suffix}"
region = "us-central1"
database_version = "POSTGRES_14"
settings {
tier = "db-custom-2-7680"
user_labels = {
track = "production"
billing-code = 34802
}
}
deletion_protection = "false"
}
resource "google_sql_database_instance" "default" {
name = "tf-test-sqlserver-instance-labels%{random_suffix}"
region = "us-central1"
database_version = "SQLSERVER_2019_STANDARD"
root_password = "INSERT-PASSWORD-HERE"
settings {
tier = "db-custom-2-7680"
user_labels = {
track = "production"
billing-code = 34802
}
}
deletion_protection = "false"
}
`, context)
}

func TestAccCGCSnippet_sqlInstancePitrExample(t *testing.T) {
t.Parallel()

context := map[string]interface{}{
"deletion_protection": false,
"random_suffix": randString(t, 10),
}

vcrTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccCGCSnippet_sqlInstancePitrExample(context),
},
{
ResourceName: "google_sql_database_instance.default",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"deletion_protection"},
},
},
})
}

func testAccCGCSnippet_sqlInstancePitrExample(context map[string]interface{}) string {
return Nprintf(`
resource "google_sql_database_instance" "default" {
name = "tf-test-mysql-instance-pitr%{random_suffix}"
region = "asia-northeast1"
database_version = "MYSQL_8_0"
settings {
tier = "db-f1-micro"
backup_configuration {
enabled = true
binary_log_enabled = true
start_time = "20:55"
transaction_log_retention_days = "3"
}
}
deletion_protection = "%{deletion_protection}"
}
resource "google_sql_database_instance" "postgres_instance_pitr" {
name = ""
region = "us-central1"
database_version = "POSTGRES_14"
settings {
tier = "db-custom-2-7680"
backup_configuration {
enabled = true
point_in_time_recovery_enabled = true
start_time = "20:55"
transaction_log_retention_days = "3"
}
}
deletion_protection = "%{deletion_protection}"
}
`, context)
}

func TestAccCGCSnippet_storageNewBucketExample(t *testing.T) {
t.Parallel()

Expand Down

0 comments on commit 041589c

Please sign in to comment.