Skip to content

Commit

Permalink
fix: update the broken functionaity of delete protection settings
Browse files Browse the repository at this point in the history
  • Loading branch information
bibek4699 committed Aug 18, 2023
1 parent 7a2fc8d commit 89aa16b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
6 changes: 3 additions & 3 deletions examples/mysql_instance_with_read_replica/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
# provider being missing.

provider "google" {
project = var.google_project
region = var.google_region
credentials = var.google_credentials
project = var.google_project
region = var.google_region
#credentials = var.google_credentials

scopes = [
# Default scopes
Expand Down
8 changes: 4 additions & 4 deletions examples/mysql_instance_with_read_replica/variable-general.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ variable "google_region" {
type = string
}

variable "google_credentials" {
description = "(Required) Currently the only supported service account credentials are credentials downloaded from Cloud Console or generated by gcloud"
type = string
}
#variable "google_credentials" {
# description = "(Required) Currently the only supported service account credentials are credentials downloaded from Cloud Console or generated by gcloud"
# type = string
#}
25 changes: 13 additions & 12 deletions modules/google_sql_database_instance/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
google = {
source = "hashicorp/google"
version = "~> 4.0"
version = "~> 4.48.0"
}
}
}
Expand Down Expand Up @@ -70,12 +70,13 @@ resource "google_sql_database_instance" "instance" {

settings {

tier = var.settings_tier
disk_size = var.settings_disk_size
disk_autoresize = var.settings_disk_autoresize
disk_type = var.settings_disk_type
availability_type = var.settings_availability_type
disk_autoresize_limit = var.settings_disk_autoresize_limit
tier = var.settings_tier
disk_size = var.settings_disk_size
disk_autoresize = var.settings_disk_autoresize
disk_type = var.settings_disk_type
availability_type = var.settings_availability_type
disk_autoresize_limit = var.settings_disk_autoresize_limit
deletion_protection_enabled = var.deletion_protection

backup_configuration {
enabled = var.settings_backup_configuration_enabled
Expand Down Expand Up @@ -112,7 +113,6 @@ resource "google_sql_database_instance" "instance" {
value = flag.value
}
}

}

deletion_protection = var.deletion_protection
Expand Down Expand Up @@ -161,10 +161,11 @@ resource "google_sql_database_instance" "read_replica" {

settings {

tier = var.read_replica_settings_tier
disk_size = var.settings_disk_size
disk_autoresize = var.settings_disk_autoresize
disk_type = var.settings_disk_type
tier = var.read_replica_settings_tier
disk_size = var.settings_disk_size
disk_autoresize = var.settings_disk_autoresize
disk_type = var.settings_disk_type
deletion_protection_enabled = var.deletion_protection

# Not supported for Read Replica
availability_type = "ZONAL"
Expand Down

0 comments on commit 89aa16b

Please sign in to comment.