Skip to content

Commit

Permalink
Added Cloud SQL postgres + authorized network example (GoogleCloudPla…
Browse files Browse the repository at this point in the history
…tform#5792)

* Added Cloud SQL postgres with authorized network example for inclusion in CGC docs

* Added missing primary_resource_type

* Fixed deletion protection

* Added Cloud SQL postgres + authorized network example
  • Loading branch information
betsy-lichtenberg authored and lcaggio committed Mar 16, 2022
1 parent 4b92eb7 commit 88b79e5
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
15 changes: 15 additions & 0 deletions mmv1/products/cgc/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,24 @@ overrides: !ruby/object:Overrides::ResourceOverrides
primary_resource_id: "default"
vars:
myinstance: "myinstance"
sqlserver_instance_with_authorized_network: "sqlserver-instance-with-authorized-network"
deletion_protection: "true"
test_vars_overrides:
deletion_protection: "false"
ignore_read_extra:
- "deletion_protection"
- "root_password"
- !ruby/object:Provider::Terraform::Examples
name: "sql_postgres_instance_authorized_network"
primary_resource_type: "google_sql_database_instance"
primary_resource_id: "default"
vars:
postgres_instance_with_authorized_network: "postgres-instance-with-authorized-network"
deletion_protection: "true"
test_vars_overrides:
deletion_protection: "false"
ignore_read_extra:
- "deletion_protection"
# Storage
- !ruby/object:Provider::Terraform::Examples
name: "storage_new_bucket"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# [START cloud_sql_postgres_instance_authorized_network]
resource "google_sql_database_instance" "<%= ctx[:primary_resource_id] %>" {
name = "<%= ctx[:vars]['postgres_instance_with_authorized_network'] %>"
region = "us-central1"
database_version = "POSTGRES_12"
settings {
tier = "db-custom-2-7680"
ip_configuration {
authorized_networks {
name = "Network Name"
value = "192.0.2.0/24"
expiration_time = "3021-11-15T16:19:00.094Z"
}
}
}
deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>"
}
# [END cloud_sql_postgres_instance_authorized_network]

0 comments on commit 88b79e5

Please sign in to comment.