Skip to content

Commit

Permalink
Fix blueprints tests
Browse files Browse the repository at this point in the history
  • Loading branch information
juliocc committed Oct 5, 2023
1 parent 46a9060 commit 350e952
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ variable "data_eng_principal" {

variable "deletion_protection" {
description = "Prevent Terraform from destroying data storage resources (storage buckets, GKE clusters, CloudSQL instances) in this blueprint. When this field is set in Terraform state, a terraform destroy or terraform apply that would delete data storage resources will fail."
type = true
type = bool
default = false
nullable = false
}
Expand Down
2 changes: 1 addition & 1 deletion blueprints/data-solutions/cmek-via-centralized-kms/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,5 @@ module "kms-gcs" {
location = var.region
storage_class = "REGIONAL"
encryption_key = local.kms_keys.gcs
force_delete = !var.deletion_protection
force_destroy = !var.deletion_protection
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ module "load-cs-df-0" {
location = var.location
storage_class = "MULTI_REGIONAL"
encryption_key = try(local.service_encryption_keys.storage, null)
force_delete = !var.deletion_protection
force_destroy = !var.deletion_protection
}

module "load-vpc" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ module "orch-cs-0" {
location = var.location
storage_class = "MULTI_REGIONAL"
encryption_key = try(local.service_encryption_keys.storage, null)
force_delete = !var.deletion_protection
force_destroy = !var.deletion_protection
}

module "orch-vpc" {
Expand Down Expand Up @@ -165,7 +165,7 @@ module "orch-cs-df-template" {
location = var.region
storage_class = "REGIONAL"
encryption_key = try(local.service_encryption_keys.storage, null)
force_delete = !var.deletion_protection
force_destroy = !var.deletion_protection
}

module "orch-cs-build-staging" {
Expand All @@ -176,7 +176,7 @@ module "orch-cs-build-staging" {
location = var.region
storage_class = "REGIONAL"
encryption_key = try(local.service_encryption_keys.storage, null)
force_delete = !var.deletion_protection
force_destroy = !var.deletion_protection
}

module "orch-sa-df-build" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ module "transf-cs-df-0" {
location = var.location
storage_class = "MULTI_REGIONAL"
encryption_key = try(local.service_encryption_keys.storage, null)
force_delete = !var.deletion_protection
force_destroy = !var.deletion_protection
}

module "transf-sa-bq-0" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ variable "data_catalog_tags" {

variable "deletion_protection" {
description = "Prevent Terraform from destroying data storage resources (storage buckets, GKE clusters, CloudSQL instances) in this blueprint. When this field is set in Terraform state, a terraform destroy or terraform apply that would delete data storage resources will fail."
type = true
type = bool
default = false
nullable = false
}
Expand Down
2 changes: 1 addition & 1 deletion blueprints/data-solutions/data-playground/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ module "bucket" {
location = var.location
name = "data"
encryption_key = try(local.service_encryption_keys.storage, null) # Example assignment of an encryption key
force_delete = !var.deletion_protection
force_destroy = !var.deletion_protection
}

module "dataset" {
Expand Down
2 changes: 1 addition & 1 deletion blueprints/gke/multitenant-fleet/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ variable "clusters" {

variable "deletion_protection" {
description = "Prevent Terraform from destroying data storage resources (storage buckets, GKE clusters, CloudSQL instances) in this blueprint. When this field is set in Terraform state, a terraform destroy or terraform apply that would delete data storage resources will fail."
type = true
type = bool
default = false
nullable = false
}
Expand Down
10 changes: 5 additions & 5 deletions fast/stages/3-data-platform/dev/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2022 Google LLC
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,10 +17,10 @@
# tfdoc:file:description Data Platform.

module "data-platform" {
source = "../../../../blueprints/data-solutions/data-platform-foundations"
composer_config = var.composer_config
data_force_destroy = var.data_force_destroy
data_catalog_tags = var.data_catalog_tags
source = "../../../../blueprints/data-solutions/data-platform-foundations"
composer_config = var.composer_config
deletion_protection = var.deletion_protection
data_catalog_tags = var.data_catalog_tags
project_config = {
billing_account_id = var.billing_account.id
parent = var.folder_ids.data-platform-dev
Expand Down
9 changes: 5 additions & 4 deletions fast/stages/3-data-platform/dev/variables.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 Google LLC
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -98,10 +98,11 @@ variable "data_catalog_tags" {
}
}

variable "data_force_destroy" {
description = "Flag to set 'force_destroy' on data services like BigQery or Cloud Storage."
variable "deletion_protection" {
description = "Prevent Terraform from destroying data storage resources (storage buckets, GKE clusters, CloudSQL instances) in this blueprint. When this field is set in Terraform state, a terraform destroy or terraform apply that would delete data storage resources will fail."
type = bool
default = false
default = true
nullable = false
}

variable "folder_ids" {
Expand Down
2 changes: 1 addition & 1 deletion tests/modules/cloudsql_instance/examples/insights.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ values:
collation: null
data_cache_config: []
database_flags: []
deletion_protection_enabled: false
deletion_protection_enabled: true
deny_maintenance_period: []
disk_autoresize: true
disk_autoresize_limit: 0
Expand Down
4 changes: 2 additions & 2 deletions tests/modules/cloudsql_instance/examples/public-ip.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ values:
collation: null
data_cache_config: []
database_flags: []
deletion_protection_enabled: false
deletion_protection_enabled: true
deny_maintenance_period: []
disk_autoresize: true
disk_autoresize_limit: 0
Expand Down Expand Up @@ -72,7 +72,7 @@ values:
collation: null
data_cache_config: []
database_flags: []
deletion_protection_enabled: false
deletion_protection_enabled: true
deny_maintenance_period: []
disk_autoresize: true
disk_autoresize_limit: 0
Expand Down
2 changes: 1 addition & 1 deletion tests/modules/cloudsql_instance/examples/simple.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ values:
collation: null
data_cache_config: []
database_flags: []
deletion_protection_enabled: false
deletion_protection_enabled: true
deny_maintenance_period: []
disk_autoresize: true
disk_autoresize_limit: 0
Expand Down

0 comments on commit 350e952

Please sign in to comment.