@hiiretail/gcp-infra-cli 0.104.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -46
- package/bin/gcp-infra +5 -2
- package/package.json +7 -30
- package/src/gcp-infra.js +90 -0
- package/LICENSE +0 -21
- package/generators/clan-resources/clan-project/generator.json +0 -4
- package/generators/clan-resources/clan-project/index.js +0 -135
- package/generators/clan-resources/clan-project/templates/clan-resources/cloud-nat/terragrunt.hcl +0 -52
- package/generators/clan-resources/clan-project/templates/clan-resources/cloud-nat-static-ip/spec.hcl +0 -7
- package/generators/clan-resources/clan-project/templates/clan-resources/cloud-nat-static-ip/terragrunt.hcl +0 -25
- package/generators/clan-resources/clan-project/templates/clan-resources/cloud-router/terragrunt.hcl +0 -34
- package/generators/clan-resources/clan-project/templates/clan-resources/gke/gke-resources/terragrunt.hcl +0 -40
- package/generators/clan-resources/clan-project/templates/clan-resources/gke/spec.hcl +0 -18
- package/generators/clan-resources/clan-project/templates/clan-resources/gke/terragrunt.hcl +0 -52
- package/generators/clan-resources/clan-project/templates/clan-resources/network/firewall-rules/config/main.tf +0 -41
- package/generators/clan-resources/clan-project/templates/clan-resources/network/firewall-rules/config/vars.tf +0 -9
- package/generators/clan-resources/clan-project/templates/clan-resources/network/firewall-rules/terragrunt.hcl +0 -32
- package/generators/clan-resources/clan-project/templates/clan-resources/network/spec.hcl +0 -54
- package/generators/clan-resources/clan-project/templates/clan-resources/network/terragrunt.hcl +0 -29
- package/generators/clan-resources/clan-project/templates/clan-resources/private-vpc-connection/config/main.tf +0 -18
- package/generators/clan-resources/clan-project/templates/clan-resources/private-vpc-connection/config/vars.tf +0 -27
- package/generators/clan-resources/clan-project/templates/clan-resources/private-vpc-connection/terragrunt.hcl +0 -35
- package/generators/clan-resources/clan-project/templates/clan-resources/serverless-vpc-connector/terragrunt.hcl +0 -40
- package/generators/clan-resources/clan-project/templates/clan-resources/terragrunt.hcl +0 -3
- package/generators/clan-resources/command.json +0 -7
- package/generators/common-resources/bigquery/generator.json +0 -4
- package/generators/common-resources/bigquery/index.js +0 -284
- package/generators/common-resources/bigquery/templates/bigquery/spec.hcl +0 -8
- package/generators/common-resources/bigquery/templates/bigquery/terragrunt.hcl +0 -53
- package/generators/common-resources/bigquery/templates/scheduled-queries/terragrunt.hcl +0 -56
- package/generators/common-resources/bigquery/templates/schema/schema.json +0 -14
- package/generators/common-resources/budget/generator.json +0 -4
- package/generators/common-resources/budget/index.js +0 -89
- package/generators/common-resources/budget/templates/budget/terragrunt.hcl +0 -45
- package/generators/common-resources/cloud-armor/generator.json +0 -4
- package/generators/common-resources/cloud-armor/index.js +0 -45
- package/generators/common-resources/cloud-armor/templates/policies.yaml +0 -53
- package/generators/common-resources/cloud-armor/templates/terragrunt.hcl +0 -30
- package/generators/common-resources/cloud-storage/generator.json +0 -4
- package/generators/common-resources/cloud-storage/index.js +0 -156
- package/generators/common-resources/cloud-storage/templates/cloud-storage/storage.yaml +0 -26
- package/generators/common-resources/cloud-storage/templates/cloud-storage/terragrunt.hcl +0 -32
- package/generators/common-resources/cloudsql/generator.json +0 -4
- package/generators/common-resources/cloudsql/index.js +0 -106
- package/generators/common-resources/cloudsql/templates/mssql/instance/spec.hcl +0 -76
- package/generators/common-resources/cloudsql/templates/mssql/instance/terragrunt.hcl +0 -38
- package/generators/common-resources/cloudsql/templates/mssql/instance-secrets/terragrunt.hcl +0 -37
- package/generators/common-resources/cloudsql/templates/mysql/instance/spec.hcl +0 -73
- package/generators/common-resources/cloudsql/templates/mysql/instance/terragrunt.hcl +0 -40
- package/generators/common-resources/cloudsql/templates/mysql/instance-secrets/terragrunt.hcl +0 -38
- package/generators/common-resources/cloudsql/templates/postgres-clan/instance/spec.hcl +0 -102
- package/generators/common-resources/cloudsql/templates/postgres-clan/instance/terragrunt.hcl +0 -36
- package/generators/common-resources/cloudsql/templates/postgres-clan/instance-secrets/terragrunt.hcl +0 -44
- package/generators/common-resources/cloudsql-database/generator.json +0 -4
- package/generators/common-resources/cloudsql-database/index.js +0 -70
- package/generators/common-resources/cloudsql-database/templates/mysql/database/proxy_port.hcl +0 -4
- package/generators/common-resources/cloudsql-database/templates/mysql/database/terragrunt.hcl +0 -69
- package/generators/common-resources/cloudsql-database/templates/mysql/outputs.json +0 -5
- package/generators/common-resources/cloudsql-database/templates/mysql/secrets/terragrunt.hcl +0 -30
- package/generators/common-resources/cloudsql-database/templates/postgres/database/proxy_port.hcl +0 -4
- package/generators/common-resources/cloudsql-database/templates/postgres/database/spec.hcl +0 -17
- package/generators/common-resources/cloudsql-database/templates/postgres/database/terragrunt.hcl +0 -74
- package/generators/common-resources/cloudsql-database/templates/postgres/outputs.json +0 -5
- package/generators/common-resources/cloudsql-database/templates/postgres/secrets/terragrunt.hcl +0 -30
- package/generators/common-resources/command.json +0 -8
- package/generators/common-resources/confluent-cluster/generator.json +0 -4
- package/generators/common-resources/confluent-cluster/index.js +0 -52
- package/generators/common-resources/confluent-cluster/templates/confluent/spec.hcl +0 -5
- package/generators/common-resources/confluent-cluster/templates/confluent/terragrunt.hcl +0 -25
- package/generators/common-resources/datastore/generator.json +0 -4
- package/generators/common-resources/datastore/index.js +0 -91
- package/generators/common-resources/datastore/templates/datastore/indexes.yaml +0 -6
- package/generators/common-resources/datastore/templates/datastore/terragrunt.hcl +0 -23
- package/generators/common-resources/elastic-cloud/generator.json +0 -4
- package/generators/common-resources/elastic-cloud/index.js +0 -52
- package/generators/common-resources/elastic-cloud/templates/elastic/spec.hcl +0 -27
- package/generators/common-resources/elastic-cloud/templates/elastic/terragrunt.hcl +0 -27
- package/generators/common-resources/elastic-index-policy/generator.json +0 -4
- package/generators/common-resources/elastic-index-policy/handle-yaml.js +0 -76
- package/generators/common-resources/elastic-index-policy/index.js +0 -210
- package/generators/common-resources/elastic-index-policy/templates/policy/policy.yaml +0 -28
- package/generators/common-resources/elastic-index-policy/templates/policy/terragrunt.hcl +0 -25
- package/generators/common-resources/elastic-template/generator.json +0 -4
- package/generators/common-resources/elastic-template/index.js +0 -84
- package/generators/common-resources/elastic-template/templates/elastic-template/mappings.json +0 -1
- package/generators/common-resources/elastic-template/templates/elastic-template/terragrunt.hcl +0 -35
- package/generators/common-resources/firestore/generator.json +0 -4
- package/generators/common-resources/firestore/index.js +0 -141
- package/generators/common-resources/firestore/templates/firestore/indexes/indexes.yaml +0 -12
- package/generators/common-resources/firestore/templates/firestore/indexes/terragrunt.hcl +0 -27
- package/generators/common-resources/firestore/templates/firestore/spec.hcl +0 -31
- package/generators/common-resources/firestore/templates/firestore/terragrunt.hcl +0 -25
- package/generators/common-resources/iam/generator.json +0 -4
- package/generators/common-resources/iam/index.js +0 -62
- package/generators/common-resources/iam/templates/github/workflows/iam.yml +0 -18
- package/generators/common-resources/iam/templates/iam.yaml +0 -8
- package/generators/common-resources/iam/valid-prefix.js +0 -8
- package/generators/common-resources/kafka-connect/generator.json +0 -4
- package/generators/common-resources/kafka-connect/index.js +0 -75
- package/generators/common-resources/kafka-connect/templates/elastic/terragrunt.hcl +0 -92
- package/generators/common-resources/kafka-connect/templates/pubsub/terragrunt.hcl +0 -75
- package/generators/common-resources/kafka-topics/generator.json +0 -4
- package/generators/common-resources/kafka-topics/index.js +0 -54
- package/generators/common-resources/kafka-topics/templates/kafka/kafka.yaml +0 -20
- package/generators/common-resources/kafka-topics/templates/kafka/terragrunt.hcl +0 -21
- package/generators/common-resources/kms/generator.json +0 -4
- package/generators/common-resources/kms/index.js +0 -69
- package/generators/common-resources/kms/templates/kms/spec.hcl +0 -5
- package/generators/common-resources/kms/templates/kms/terragrunt.hcl +0 -33
- package/generators/common-resources/memorystore/generator.json +0 -4
- package/generators/common-resources/memorystore/index.js +0 -69
- package/generators/common-resources/memorystore/templates/outputs.json +0 -3
- package/generators/common-resources/memorystore/templates/redis-instance/spec.hcl +0 -16
- package/generators/common-resources/memorystore/templates/redis-instance/terragrunt.hcl +0 -35
- package/generators/common-resources/memorystore/templates/secrets/terragrunt.hcl +0 -31
- package/generators/common-resources/monitoring/generator.json +0 -4
- package/generators/common-resources/monitoring/handle-yaml.js +0 -48
- package/generators/common-resources/monitoring/index.js +0 -192
- package/generators/common-resources/monitoring/templates/alerts/generic-infra.yaml +0 -633
- package/generators/common-resources/monitoring/templates/alerts/terragrunt.hcl +0 -37
- package/generators/common-resources/monitoring/templates/service/service.yaml +0 -16
- package/generators/common-resources/monitoring/templates/service/terragrunt.hcl +0 -37
- package/generators/common-resources/monitoring/templates/uptime-checks/terragrunt.hcl +0 -36
- package/generators/common-resources/monitoring/templates/uptime-checks/uptime-checks.yaml +0 -3
- package/generators/common-resources/monitoring/validate.js +0 -58
- package/generators/common-resources/pubsub/append.js +0 -120
- package/generators/common-resources/pubsub/generator.json +0 -4
- package/generators/common-resources/pubsub/get-gcp-projects.js +0 -34
- package/generators/common-resources/pubsub/handle-subscribers.js +0 -63
- package/generators/common-resources/pubsub/index.js +0 -316
- package/generators/common-resources/pubsub/templates/pubsub/spec.hcl +0 -7
- package/generators/common-resources/pubsub/templates/pubsub/subscribers.yaml +0 -16
- package/generators/common-resources/pubsub/templates/pubsub/terragrunt.hcl +0 -34
- package/generators/common-resources/pubsub/templates/pubsub-dlq/terragrunt.hcl +0 -42
- package/generators/common-resources/pubsub/templates/pubsub-external/spec.hcl +0 -10
- package/generators/common-resources/pubsub/templates/pubsub-external/subscribers.yaml +0 -16
- package/generators/common-resources/pubsub/templates/pubsub-external/terragrunt.hcl +0 -31
- package/generators/common-resources/pubsub/validate.js +0 -44
- package/generators/common-resources/scheduler/append.js +0 -83
- package/generators/common-resources/scheduler/generator.json +0 -4
- package/generators/common-resources/scheduler/index.js +0 -103
- package/generators/common-resources/scheduler/templates/scheduler/terragrunt.hcl +0 -44
- package/generators/common-resources/spanner/append.js +0 -27
- package/generators/common-resources/spanner/generator.json +0 -4
- package/generators/common-resources/spanner/index.js +0 -169
- package/generators/common-resources/spanner/templates/spanner/databases.yaml +0 -5
- package/generators/common-resources/spanner/templates/spanner/spec.hcl +0 -22
- package/generators/common-resources/spanner/templates/spanner/terragrunt.hcl +0 -33
- package/generators/common-resources/spanner/validate.js +0 -38
- package/generators/docs/command.json +0 -7
- package/generators/docs/rca/generator.json +0 -4
- package/generators/docs/rca/index.js +0 -50
- package/generators/docs/rca/templates/docs/rca_external.md +0 -43
- package/generators/docs/rca/templates/docs/rca_internal.md +0 -88
- package/generators/docs/runbook/generator.json +0 -4
- package/generators/docs/runbook/index.js +0 -42
- package/generators/docs/runbook/templates/docs/runbook.md +0 -106
- package/generators/docs/srb/generator.json +0 -4
- package/generators/docs/srb/index.js +0 -62
- package/generators/docs/srb/templates/docs/README.md +0 -42
- package/generators/docs/srb/templates/docs/adr.cmd +0 -3
- package/generators/docs/srb/templates/docs/adr.sh +0 -4
- package/generators/docs/srb/templates/docs/architecture.md +0 -68
- package/generators/docs/srb/templates/docs/cost-estimates.md +0 -39
- package/generators/docs/srb/templates/docs/dsl2png.cmd +0 -3
- package/generators/docs/srb/templates/docs/dsl2png.sh +0 -4
- package/generators/docs/srb/templates/docs/sre.md +0 -43
- package/generators/docs/srb/templates/sample.dsl +0 -36
- package/generators/init/clan-infra/gcp-projects.js +0 -36
- package/generators/init/clan-infra/generator.json +0 -4
- package/generators/init/clan-infra/index.js +0 -170
- package/generators/init/clan-infra/templates/.yamllint +0 -17
- package/generators/init/clan-infra/templates/env/project.hcl +0 -15
- package/generators/init/clan-infra/templates/env/secrets/secrets.yaml +0 -4
- package/generators/init/clan-infra/templates/env/secrets/terragrunt.hcl +0 -31
- package/generators/init/clan-infra/templates/github/CODEOWNERS +0 -1
- package/generators/init/clan-infra/templates/github/workflows/infra-verify.yml +0 -16
- package/generators/init/clan-infra/templates/github/workflows/infra.yml +0 -17
- package/generators/init/clan-infra/templates/github/workflows/release-notes.yml +0 -33
- package/generators/init/clan-infra/templates/github/workflows/sync-docs.yml +0 -29
- package/generators/init/clan-infra/templates/infra/.terraform-version +0 -1
- package/generators/init/clan-infra/templates/infra/.terragrunt-version +0 -1
- package/generators/init/clan-infra/templates/infra/README.md +0 -5
- package/generators/init/clan-infra/templates/infra/common.hcl +0 -24
- package/generators/init/clan-infra/templates/infra/terragrunt_root.hcl +0 -44
- package/generators/init/clan-infra/templates/notification-channels/notification-channels.yaml +0 -7
- package/generators/init/clan-infra/templates/notification-channels/terragrunt.hcl +0 -29
- package/generators/init/clan-infra/templates/release-notes/example-service.yaml +0 -23
- package/generators/init/clan-infra/templates/release-notes-schema/release-notes.schema.json +0 -63
- package/generators/init/clan-infra/tribe-clan-repo.js +0 -38
- package/generators/init/clan-infra/validate.js +0 -8
- package/generators/init/command.json +0 -7
- package/generators/maintenance/command.json +0 -7
- package/generators/maintenance/manage-states/generator.json +0 -4
- package/generators/maintenance/manage-states/index.js +0 -188
- package/generators/maintenance/update-modules/generator.json +0 -4
- package/generators/maintenance/update-modules/index.js +0 -102
- package/generators/organization/clan-project/__tests__/__snapshots__/googlecloud.test.js.snap +0 -27
- package/generators/organization/clan-project/generator.json +0 -4
- package/generators/organization/clan-project/googlecloud.js +0 -119
- package/generators/organization/clan-project/index.js +0 -139
- package/generators/organization/clan-project/templates/clan/clan.yaml +0 -22
- package/generators/organization/clan-project/templates/clan/terragrunt.hcl +0 -39
- package/generators/organization/clan-project/templates/clan-project/project.yaml +0 -14
- package/generators/organization/clan-project/templates/clan-project/terragrunt.hcl +0 -51
- package/generators/organization/clan-project/templates/clans-folder/terragrunt.hcl +0 -3
- package/generators/organization/clan-project/templates/department/terragrunt.hcl +0 -32
- package/generators/organization/clan-project/templates/tribe/terragrunt.hcl +0 -67
- package/generators/organization/clan-project/templates/tribe/tribe.yaml +0 -19
- package/generators/organization/command.json +0 -8
- package/src/BaseGenerator.js +0 -73
- package/src/SecretsGenerator.js +0 -105
- package/src/cli.js +0 -73
- package/src/dependency-check.js +0 -48
- package/src/update-check.js +0 -30
- package/src/validators.js +0 -32
- package/src/yeoman.js +0 -71
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
locals {
|
|
2
|
-
###################
|
|
3
|
-
# REQUIRED INPUTS #
|
|
4
|
-
###################
|
|
5
|
-
|
|
6
|
-
# "You cannot reuse an instance name for up to a week after you have deleted an instance."
|
|
7
|
-
# See https://cloud.google.com/sql/docs/mysql/delete-instance for details.
|
|
8
|
-
|
|
9
|
-
zone = "europe-west1-b"
|
|
10
|
-
|
|
11
|
-
database_version = "<%- instanceDatabaseVersion %>"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
###################
|
|
15
|
-
# OPTIONAL INPUTS #
|
|
16
|
-
###################
|
|
17
|
-
|
|
18
|
-
#Memory size, in GiB | Maximum concurrent connections
|
|
19
|
-
#--------------------+-------------------------------
|
|
20
|
-
#0.6 (db-f1-micro) | 25
|
|
21
|
-
#1.7 (db-g1-small) | 50
|
|
22
|
-
#3.75 up to 6 | 100
|
|
23
|
-
#6 up to 7.5 | 150
|
|
24
|
-
#7.5 up to 15 | 200
|
|
25
|
-
#15 up to 30 | 250
|
|
26
|
-
#30 up to 60 | 300
|
|
27
|
-
#60 up to 120 | 400
|
|
28
|
-
#120 and above | 500
|
|
29
|
-
tier = "db-custom-1-3840"
|
|
30
|
-
|
|
31
|
-
peering_completed = "true"
|
|
32
|
-
|
|
33
|
-
#Description: The activation policy for the master instance.Can be either `ALWAYS`, `NEVER` or `ON_DEMAND`.
|
|
34
|
-
#Type: String
|
|
35
|
-
#Default: "ALWAYS"
|
|
36
|
-
# activation_policy = "ON_DEMAND"
|
|
37
|
-
|
|
38
|
-
#Description: The availability type for the master instance.This is only used to set up high availability for the PostgreSQL instance. Can be either `ZONAL` or `REGIONAL`.
|
|
39
|
-
#Type: String
|
|
40
|
-
#Default: "ZONAL"
|
|
41
|
-
# availability_type = "REGIONAL"
|
|
42
|
-
|
|
43
|
-
#Description: The backup_configuration settings subblock for the database setings
|
|
44
|
-
#Type: object({ binary_log_enabled = bool enabled = bool start_time = string })
|
|
45
|
-
#Default: { "binary_log_enabled": null, "enabled": false, "start_time": null }
|
|
46
|
-
# backup_configuration = { "binary_log_enabled": null, "enabled": false, "start_time": null }
|
|
47
|
-
|
|
48
|
-
#Description: The collation for the default database. Example: 'en_US.UTF8'
|
|
49
|
-
#Type: String
|
|
50
|
-
#Default: ""
|
|
51
|
-
# db_charset = "en_US.UTF8"
|
|
52
|
-
|
|
53
|
-
#Description: The name of the default database to create
|
|
54
|
-
#Type: String
|
|
55
|
-
#Default: "default"
|
|
56
|
-
# db_name = "default"
|
|
57
|
-
|
|
58
|
-
#Description: The disk size (in GB) for the master instance.
|
|
59
|
-
#Type: Integer
|
|
60
|
-
#Default: 10
|
|
61
|
-
disk_size = <%- diskSize %>
|
|
62
|
-
|
|
63
|
-
#Description: The disk type for the master instance.
|
|
64
|
-
#Type: String
|
|
65
|
-
#Default: "PD_SSD"
|
|
66
|
-
# disk_type = "PD_SSD"
|
|
67
|
-
|
|
68
|
-
#Description: The database backup configuration.
|
|
69
|
-
#Type: Map
|
|
70
|
-
backup_configuration = {
|
|
71
|
-
enabled = <%- enableBackups %>
|
|
72
|
-
binary_log_enabled = enabled
|
|
73
|
-
start_time = "04:00"
|
|
74
|
-
point_in_time_recovery_enabled = true
|
|
75
|
-
}
|
|
76
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
# Terragrunt will copy the Terraform configurations specified by the source parameter, along with any files in the
|
|
2
|
-
# working directory, into a temporary folder, and execute your Terraform commands in that folder.
|
|
3
|
-
terraform {
|
|
4
|
-
source = "git::https://github.com/terraform-google-modules/terraform-google-sql-db//modules/mssql?ref=v4.0.0"
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
# Include all settings from the root terragrunt.hcl file
|
|
8
|
-
include {
|
|
9
|
-
path = find_in_parent_folders("terragrunt_root.hcl")
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
locals {
|
|
13
|
-
spec_vars = read_terragrunt_config("${get_terragrunt_dir()}/spec.hcl")
|
|
14
|
-
project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
|
|
15
|
-
common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
|
|
16
|
-
labels = merge(local.common_vars.locals.default_user_labels, local.project_vars.locals.default_user_labels, {
|
|
17
|
-
component = local.common_vars.locals.component
|
|
18
|
-
product = local.common_vars.locals.product
|
|
19
|
-
tenant-alias = local.common_vars.locals.tenant_alias
|
|
20
|
-
})
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
# These are the variables we have to pass in to use the module specified in the terragrunt configuration above
|
|
24
|
-
inputs = merge(
|
|
25
|
-
local.spec_vars.locals,
|
|
26
|
-
{
|
|
27
|
-
name = "mssql-${local.project_vars.locals.project_name}-clan"
|
|
28
|
-
ip_configuration = {
|
|
29
|
-
"authorized_networks" : [],
|
|
30
|
-
"ipv4_enabled" : true,
|
|
31
|
-
"private_network" : "https://www.googleapis.com/compute/v1/projects/${local.project_vars.locals.project_id}/global/networks/${local.project_vars.locals.clan_network}",
|
|
32
|
-
"require_ssl" : false
|
|
33
|
-
}
|
|
34
|
-
## Uncomment and apply it before destroy in case of necessary to delete the instance
|
|
35
|
-
# deletion_protection = false
|
|
36
|
-
user_labels = local.labels,
|
|
37
|
-
}
|
|
38
|
-
)
|
package/generators/common-resources/cloudsql/templates/mssql/instance-secrets/terragrunt.hcl
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# Terragrunt will copy the Terraform configurations specified by the source parameter, along with any files in the
|
|
2
|
-
# working directory, into a temporary folder, and execute your Terraform commands in that folder.
|
|
3
|
-
terraform {
|
|
4
|
-
source = "git::https://github.com/extenda/tf-module-gcp-secret-manager//?ref=v0.1.2"
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
locals {
|
|
8
|
-
project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
|
|
9
|
-
common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
|
|
10
|
-
labels = merge(local.common_vars.locals.default_user_labels, local.project_vars.locals.default_user_labels, {
|
|
11
|
-
component = local.common_vars.locals.component
|
|
12
|
-
product = local.common_vars.locals.product
|
|
13
|
-
tenant-alias = local.common_vars.locals.tenant_alias
|
|
14
|
-
terraform = ""
|
|
15
|
-
})
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
# Include all settings from the root terragrunt.hcl file
|
|
19
|
-
include {
|
|
20
|
-
path = find_in_parent_folders("terragrunt_root.hcl")
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
dependency "mssql_address" {
|
|
24
|
-
config_path = "../instance"
|
|
25
|
-
mock_outputs = {
|
|
26
|
-
private_address = "dummy-ip"
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
# These are the variables we have to pass in to use the module specified in the terragrunt configuration above
|
|
31
|
-
inputs = {
|
|
32
|
-
project_id = local.project_vars.locals.project_id
|
|
33
|
-
secrets = {
|
|
34
|
-
mssql-common-address = dependency.mssql_address.outputs.private_address
|
|
35
|
-
}
|
|
36
|
-
labels = local.labels,
|
|
37
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
locals {
|
|
2
|
-
###################
|
|
3
|
-
# REQUIRED INPUTS #
|
|
4
|
-
###################
|
|
5
|
-
|
|
6
|
-
database_version = "<%- instanceDatabaseVersion %>"
|
|
7
|
-
|
|
8
|
-
zone = "b"
|
|
9
|
-
|
|
10
|
-
###################
|
|
11
|
-
# OPTIONAL INPUTS #
|
|
12
|
-
###################
|
|
13
|
-
|
|
14
|
-
region = "europe-west1"
|
|
15
|
-
|
|
16
|
-
#Memory size, in GiB | Maximum concurrent connections
|
|
17
|
-
#--------------------+-------------------------------
|
|
18
|
-
#0.6 (db-f1-micro) | 25
|
|
19
|
-
#1.7 (db-g1-small) | 50
|
|
20
|
-
#3.75 up to 6 | 100
|
|
21
|
-
#6 up to 7.5 | 150
|
|
22
|
-
#7.5 up to 15 | 200
|
|
23
|
-
#15 up to 30 | 250
|
|
24
|
-
#30 up to 60 | 300
|
|
25
|
-
#60 up to 120 | 400
|
|
26
|
-
#120 and above | 500
|
|
27
|
-
tier = "db-g1-small"
|
|
28
|
-
|
|
29
|
-
#Description: The activation policy for the master instance.Can be either `ALWAYS`, `NEVER` or `ON_DEMAND`.
|
|
30
|
-
#Type: String
|
|
31
|
-
#Default: "ALWAYS"
|
|
32
|
-
# activation_policy = "ON_DEMAND"
|
|
33
|
-
|
|
34
|
-
#Description: The availability type for the master instance.This is only used to set up high availability for the PostgreSQL instance. Can be either `ZONAL` or `REGIONAL`.
|
|
35
|
-
#Type: String
|
|
36
|
-
#Default: "ZONAL"
|
|
37
|
-
# availability_type = "REGIONAL"
|
|
38
|
-
|
|
39
|
-
#Description: The backup_configuration settings subblock for the database setings
|
|
40
|
-
#Type: object({ binary_log_enabled = bool enabled = bool start_time = string })
|
|
41
|
-
#Default: { "binary_log_enabled": null, "enabled": false, "start_time": null }
|
|
42
|
-
# backup_configuration = { "binary_log_enabled": null, "enabled": false, "start_time": null }
|
|
43
|
-
|
|
44
|
-
#Description: The collation for the default database. Example: 'en_US.UTF8'
|
|
45
|
-
#Type: String
|
|
46
|
-
#Default: ""
|
|
47
|
-
# db_charset = "en_US.UTF8"
|
|
48
|
-
|
|
49
|
-
#Description: The name of the default database to create
|
|
50
|
-
#Type: String
|
|
51
|
-
#Default: "default"
|
|
52
|
-
# db_name = "default"
|
|
53
|
-
|
|
54
|
-
#Description: The disk size (in GB) for the master instance.
|
|
55
|
-
#Type: Integer
|
|
56
|
-
#Default: 10
|
|
57
|
-
disk_size = <%- diskSize %>
|
|
58
|
-
|
|
59
|
-
#Description: The disk type for the master instance.
|
|
60
|
-
#Type: String
|
|
61
|
-
#Default: "PD_SSD"
|
|
62
|
-
# disk_type = "PD_SSD"
|
|
63
|
-
|
|
64
|
-
#Description: The database backup configuration.
|
|
65
|
-
#Type: Map
|
|
66
|
-
#Default: missing
|
|
67
|
-
backup_configuration = {
|
|
68
|
-
enabled = <%- enableBackups %>
|
|
69
|
-
binary_log_enabled = true
|
|
70
|
-
start_time = "04:00"
|
|
71
|
-
location = "europe-west1"
|
|
72
|
-
}
|
|
73
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# Terragrunt will copy the Terraform configurations specified by the source parameter, along with any files in the
|
|
2
|
-
# working directory, into a temporary folder, and execute your Terraform commands in that folder.
|
|
3
|
-
terraform {
|
|
4
|
-
source = "git::https://github.com/terraform-google-modules/terraform-google-sql-db//modules/mysql?ref=v4.0.0"
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
# Include all settings from the root terragrunt.hcl file
|
|
8
|
-
include {
|
|
9
|
-
path = find_in_parent_folders("terragrunt_root.hcl")
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
locals {
|
|
13
|
-
spec_vars = read_terragrunt_config("${get_terragrunt_dir()}/spec.hcl")
|
|
14
|
-
project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
|
|
15
|
-
common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
|
|
16
|
-
labels = merge(local.common_vars.locals.default_user_labels, local.project_vars.locals.default_user_labels, {
|
|
17
|
-
component = local.common_vars.locals.component
|
|
18
|
-
product = local.common_vars.locals.product
|
|
19
|
-
tenant-alias = local.common_vars.locals.tenant_alias
|
|
20
|
-
terraform = ""
|
|
21
|
-
})
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
# These are the variables we have to pass in to use the module specified in the terragrunt configuration above
|
|
25
|
-
inputs = merge(
|
|
26
|
-
local.spec_vars.locals,
|
|
27
|
-
{
|
|
28
|
-
name = "mysql-${local.project_vars.locals.project_name}-clan"
|
|
29
|
-
project_id = local.project_vars.locals.project_id
|
|
30
|
-
ip_configuration = {
|
|
31
|
-
"authorized_networks" : [],
|
|
32
|
-
"ipv4_enabled" : true,
|
|
33
|
-
"private_network" : "https://www.googleapis.com/compute/v1/projects/${local.project_vars.locals.project_id}/global/networks/${local.project_vars.locals.clan_network}",
|
|
34
|
-
"require_ssl" : false
|
|
35
|
-
}
|
|
36
|
-
## Uncomment and apply it before destroy in case of necessary to delete the instance
|
|
37
|
-
# deletion_protection = false
|
|
38
|
-
user_labels = local.labels,
|
|
39
|
-
}
|
|
40
|
-
)
|
package/generators/common-resources/cloudsql/templates/mysql/instance-secrets/terragrunt.hcl
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
# Terragrunt will copy the Terraform configurations specified by the source parameter, along with any files in the
|
|
2
|
-
# working directory, into a temporary folder, and execute your Terraform commands in that folder.
|
|
3
|
-
terraform {
|
|
4
|
-
source = "git::https://github.com/extenda/tf-module-gcp-secret-manager//?ref=v0.1.2"
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
include {
|
|
8
|
-
path = find_in_parent_folders("terragrunt_root.hcl")
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
locals {
|
|
12
|
-
project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
|
|
13
|
-
common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
|
|
14
|
-
labels = merge(local.common_vars.locals.default_user_labels, local.project_vars.locals.default_user_labels, {
|
|
15
|
-
component = local.common_vars.locals.component
|
|
16
|
-
product = local.common_vars.locals.product
|
|
17
|
-
tenant-alias = local.common_vars.locals.tenant_alias
|
|
18
|
-
terraform = ""
|
|
19
|
-
})
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
dependency "instance" {
|
|
23
|
-
config_path = "../instance"
|
|
24
|
-
mock_outputs = {
|
|
25
|
-
private_ip_address = "dummy-ip"
|
|
26
|
-
generated_user_password = "dummy-password"
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
# These are the variables we have to pass in to use the module specified in the terragrunt configuration above
|
|
31
|
-
inputs = {
|
|
32
|
-
project_id = local.project_vars.locals.project_id
|
|
33
|
-
secrets = {
|
|
34
|
-
mysql_master_password = dependency.instance.outputs.generated_user_password
|
|
35
|
-
mysql_private_address = dependency.instance.outputs.private_ip_address
|
|
36
|
-
}
|
|
37
|
-
labels = local.labels,
|
|
38
|
-
}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
locals {
|
|
2
|
-
###################
|
|
3
|
-
# REQUIRED INPUTS #
|
|
4
|
-
###################
|
|
5
|
-
|
|
6
|
-
database_version = "<%- instanceDatabaseVersion %>"
|
|
7
|
-
|
|
8
|
-
zone = "europe-west1-b"
|
|
9
|
-
|
|
10
|
-
###################
|
|
11
|
-
# OPTIONAL INPUTS #
|
|
12
|
-
###################
|
|
13
|
-
|
|
14
|
-
region = "europe-west1"
|
|
15
|
-
|
|
16
|
-
#When selecting the number of CPUs and amount of memory, there are some restrictions on the configuration you choose:
|
|
17
|
-
#vCPUs must be either 1 or an even number between 2 and 96.
|
|
18
|
-
#Memory must be:
|
|
19
|
-
#0.9 to 6.5 GB per vCPU
|
|
20
|
-
#A multiple of 256 MB
|
|
21
|
-
#At least 3.75 GB (3840 MB)
|
|
22
|
-
#Example of custom tiers covered by SLA: db-custom-1-3840, db-custom-2-7680
|
|
23
|
-
#Memory size, in GiB | Maximum concurrent connections
|
|
24
|
-
#--------------------+-------------------------------
|
|
25
|
-
#0.6 (db-f1-micro) | 25 (shared tier, not covered by SLA)
|
|
26
|
-
#1.7 (db-g1-small) | 50 (shared tier, not covered by SLA)
|
|
27
|
-
#3.75 up to 6 | 100
|
|
28
|
-
#6 up to 7.5 | 150
|
|
29
|
-
#7.5 up to 15 | 200
|
|
30
|
-
#15 up to 30 | 250
|
|
31
|
-
#30 up to 60 | 300
|
|
32
|
-
#60 up to 120 | 400
|
|
33
|
-
#120 and above | 500
|
|
34
|
-
tier = "db-g1-small"
|
|
35
|
-
|
|
36
|
-
#Description: The activation policy for the master instance.Can be either `ALWAYS`, `NEVER` or `ON_DEMAND`.
|
|
37
|
-
#Type: String
|
|
38
|
-
#Default: "ALWAYS"
|
|
39
|
-
# activation_policy = "ON_DEMAND"
|
|
40
|
-
|
|
41
|
-
#Description: The availability type for the master instance.This is only used to set up high availability for the PostgreSQL instance. Can be either `ZONAL` or `REGIONAL`.
|
|
42
|
-
#Type: String
|
|
43
|
-
#Default: "ZONAL"
|
|
44
|
-
# availability_type = "REGIONAL"
|
|
45
|
-
|
|
46
|
-
#Description: The day of week (1-7) for the Cloud SQL instance maintenance.
|
|
47
|
-
#Type: Integer
|
|
48
|
-
#Default: 1
|
|
49
|
-
# maintenance_window_day = 2
|
|
50
|
-
|
|
51
|
-
#Description: The hour of day (0-23) maintenance window for the Cloud SQL instance maintenance.
|
|
52
|
-
#Type: Integer
|
|
53
|
-
#Default: 23
|
|
54
|
-
# maintenance_window_hour = 1
|
|
55
|
-
|
|
56
|
-
#Description: The update track of maintenance window for the Cloud SQL instance maintenance.Can be either `canary` or `stable`.
|
|
57
|
-
#Canary will get the maintenance update Week 1 and stable Week 2
|
|
58
|
-
#Type: String
|
|
59
|
-
#Default: "canary"
|
|
60
|
-
maintenance_window_update_track = "stable"
|
|
61
|
-
|
|
62
|
-
#Description: Enables protection of an Cloud SQL instance from accidental deletion across all surfaces (API, gcloud, Cloud Console and Terraform).
|
|
63
|
-
#Type: bool
|
|
64
|
-
#Default: false
|
|
65
|
-
deletion_protection_enabled = true
|
|
66
|
-
|
|
67
|
-
#Description: The backup_configuration settings subblock for the database setings
|
|
68
|
-
#Type: object({ binary_log_enabled = bool enabled = bool start_time = string })
|
|
69
|
-
#Default: { "binary_log_enabled": null, "enabled": false, "start_time": null }
|
|
70
|
-
# backup_configuration = { "binary_log_enabled": null, "enabled": false, "start_time": null }
|
|
71
|
-
|
|
72
|
-
#Description: The collation for the default database. Example: 'en_US.UTF8'
|
|
73
|
-
#Type: String
|
|
74
|
-
#Default: ""
|
|
75
|
-
# db_charset = "en_US.UTF8"
|
|
76
|
-
|
|
77
|
-
#Description: The name of the default database to create
|
|
78
|
-
#Type: String
|
|
79
|
-
#Default: "default"
|
|
80
|
-
# db_name = "default"
|
|
81
|
-
|
|
82
|
-
#Description: The disk size (in GB) for the master instance.
|
|
83
|
-
#Type: Integer
|
|
84
|
-
#Default: 10
|
|
85
|
-
disk_size = <%- diskSize %>
|
|
86
|
-
|
|
87
|
-
#Description: The disk type for the master instance.
|
|
88
|
-
#Type: String
|
|
89
|
-
#Default: "PD_SSD"
|
|
90
|
-
# disk_type = "PD_SSD"
|
|
91
|
-
|
|
92
|
-
#Description: The database backup configuration.
|
|
93
|
-
#Type: Map
|
|
94
|
-
#Default: missing
|
|
95
|
-
backup_configuration = {
|
|
96
|
-
enabled = <%- enableBackups %>
|
|
97
|
-
start_time = "00:00"
|
|
98
|
-
location = "europe-west1"
|
|
99
|
-
point_in_time_recovery_enabled = true
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
}
|
package/generators/common-resources/cloudsql/templates/postgres-clan/instance/terragrunt.hcl
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# Terragrunt will copy the Terraform configurations specified by the source parameter, along with any files in the
|
|
2
|
-
# working directory, into a temporary folder, and execute your Terraform commands in that folder.
|
|
3
|
-
terraform {
|
|
4
|
-
source = "git::https://github.com/terraform-google-modules/terraform-google-sql-db//modules/postgresql?ref=v21.0.0"
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
# Include all settings from the root terragrunt.hcl file
|
|
8
|
-
include {
|
|
9
|
-
path = find_in_parent_folders("terragrunt_root.hcl")
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
locals {
|
|
13
|
-
spec_vars = read_terragrunt_config("${get_terragrunt_dir()}/spec.hcl")
|
|
14
|
-
project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
|
|
15
|
-
common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
|
|
16
|
-
labels = merge(local.common_vars.locals.default_user_labels, local.project_vars.locals.default_user_labels, {
|
|
17
|
-
component = local.common_vars.locals.component
|
|
18
|
-
product = local.common_vars.locals.product
|
|
19
|
-
tenant-alias = local.common_vars.locals.tenant_alias
|
|
20
|
-
})
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
# These are the variables we have to pass in to use the module specified in the terragrunt configuration above
|
|
24
|
-
inputs = merge(
|
|
25
|
-
local.spec_vars.locals,
|
|
26
|
-
{
|
|
27
|
-
name = "postgresql-${local.project_vars.locals.project_name}-clan"
|
|
28
|
-
ip_configuration = {
|
|
29
|
-
"authorized_networks" : [],
|
|
30
|
-
"ipv4_enabled" : true,
|
|
31
|
-
"private_network" : "https://www.googleapis.com/compute/v1/projects/${local.project_vars.locals.project_id}/global/networks/${local.project_vars.locals.clan_network}",
|
|
32
|
-
"ssl_mode" : "ALLOW_UNENCRYPTED_AND_ENCRYPTED"
|
|
33
|
-
}
|
|
34
|
-
user_labels = local.labels,
|
|
35
|
-
}
|
|
36
|
-
)
|
package/generators/common-resources/cloudsql/templates/postgres-clan/instance-secrets/terragrunt.hcl
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
# Terragrunt will copy the Terraform configurations specified by the source parameter, along with any files in the
|
|
2
|
-
# working directory, into a temporary folder, and execute your Terraform commands in that folder.
|
|
3
|
-
terraform {
|
|
4
|
-
source = "git::https://github.com/extenda/tf-module-gcp-secret-manager//?ref=v0.1.2"
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
include {
|
|
8
|
-
path = find_in_parent_folders("terragrunt_root.hcl")
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
locals {
|
|
12
|
-
project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
|
|
13
|
-
common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
|
|
14
|
-
labels = merge(local.common_vars.locals.default_user_labels, local.project_vars.locals.default_user_labels, {
|
|
15
|
-
component = local.common_vars.locals.component
|
|
16
|
-
product = local.common_vars.locals.product
|
|
17
|
-
tenant-alias = local.common_vars.locals.tenant_alias
|
|
18
|
-
terraform = ""
|
|
19
|
-
})
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
dependency "instance" {
|
|
23
|
-
config_path = "../instance"
|
|
24
|
-
mock_outputs = {
|
|
25
|
-
instance_connection_name = "dummy-connection-name"
|
|
26
|
-
generated_user_password = "dummy-password"
|
|
27
|
-
public_ip_address = "dummy-ip"
|
|
28
|
-
private_ip_address = "dummy-ip"
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
# These are the variables we have to pass in to use the module specified in the terragrunt configuration above
|
|
33
|
-
inputs = merge(
|
|
34
|
-
{
|
|
35
|
-
project_id = local.project_vars.locals.project_id
|
|
36
|
-
secrets = {
|
|
37
|
-
postgresql_instance_connection_name = dependency.instance.outputs.instance_connection_name
|
|
38
|
-
postgresql_master_password = dependency.instance.outputs.generated_user_password
|
|
39
|
-
postgresql_public_address = dependency.instance.outputs.public_ip_address
|
|
40
|
-
postgresql_address = dependency.instance.outputs.private_ip_address
|
|
41
|
-
}
|
|
42
|
-
labels = local.labels,
|
|
43
|
-
}
|
|
44
|
-
)
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const chalk = require('chalk');
|
|
3
|
-
const { required } = require('../../../src/validators');
|
|
4
|
-
const SecretsGenerator = require('../../../src/SecretsGenerator');
|
|
5
|
-
|
|
6
|
-
module.exports = class extends SecretsGenerator {
|
|
7
|
-
prompting() {
|
|
8
|
-
const prompts = [
|
|
9
|
-
{
|
|
10
|
-
type: 'list',
|
|
11
|
-
name: 'instanceType',
|
|
12
|
-
message: 'Select Cloud SQL database instance type',
|
|
13
|
-
default: 'postgres',
|
|
14
|
-
choices: ['postgres', 'mysql'],
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
type: 'input',
|
|
18
|
-
name: 'dbName',
|
|
19
|
-
validate: required,
|
|
20
|
-
message: 'Enter the name of the service of the database be created for',
|
|
21
|
-
},
|
|
22
|
-
];
|
|
23
|
-
|
|
24
|
-
return this.prompt(prompts).then((props) => {
|
|
25
|
-
this.answers = props;
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
writing() {
|
|
30
|
-
const {
|
|
31
|
-
instanceType,
|
|
32
|
-
dbName,
|
|
33
|
-
} = this.answers;
|
|
34
|
-
|
|
35
|
-
// CloudSQL Database
|
|
36
|
-
['prod', 'staging'].forEach((env) => {
|
|
37
|
-
const randomPort = Math.floor(Math.random() * (65535 - 49152)) + 49152;
|
|
38
|
-
this.copyDir(
|
|
39
|
-
path.join(instanceType, 'database'),
|
|
40
|
-
path.join('infra', env, 'cloud-sql', instanceType, 'databases', dbName),
|
|
41
|
-
{
|
|
42
|
-
...this.answers,
|
|
43
|
-
env,
|
|
44
|
-
randomPort,
|
|
45
|
-
},
|
|
46
|
-
);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
this.writeSecrets('cloud-sql', 'databases', instanceType, dbName);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
end() {
|
|
53
|
-
const {
|
|
54
|
-
instanceType,
|
|
55
|
-
dbName,
|
|
56
|
-
} = this.answers;
|
|
57
|
-
|
|
58
|
-
const specStageFile = path.join('infra', 'staging', 'cloud-sql', instanceType, 'databases', dbName, 'spec.hcl');
|
|
59
|
-
const specProdFile = path.join('infra', 'prod', 'cloud-sql', instanceType, 'databases', dbName, 'spec.hcl');
|
|
60
|
-
|
|
61
|
-
this.log(`
|
|
62
|
-
${chalk.green(`Your CloudSQL ${instanceType} database ${chalk.cyan(dbName)} have now been created. To finalize your configuration, please continue
|
|
63
|
-
with manual editing of the generated files.`)}
|
|
64
|
-
${chalk.green('1.')} Review and change specs if needed.
|
|
65
|
-
\u2192 ${chalk.cyan(specStageFile)}
|
|
66
|
-
\u2192 ${chalk.cyan(specProdFile)}
|
|
67
|
-
${chalk.green('2.')} Push this change in a feature branch and open a pull request.
|
|
68
|
-
`);
|
|
69
|
-
}
|
|
70
|
-
};
|
package/generators/common-resources/cloudsql-database/templates/mysql/database/terragrunt.hcl
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
# Terragrunt will copy the Terraform configurations specified by the source parameter, along with any files in the
|
|
2
|
-
# working directory, into a temporary folder, and execute your Terraform commands in that folder.
|
|
3
|
-
terraform {
|
|
4
|
-
source = "git::https://github.com/extenda/tf-module-mysql//?ref=v0.1.1"
|
|
5
|
-
|
|
6
|
-
before_hook "run_postgres_proxy" {
|
|
7
|
-
commands = ["apply", "plan"]
|
|
8
|
-
execute = ["sh", "-c",
|
|
9
|
-
<<-EOF
|
|
10
|
-
set -e
|
|
11
|
-
if [ ! -f "cloud_sql_proxy" ]; then
|
|
12
|
-
echo "Downloading cloud_sql_proxy binary"
|
|
13
|
-
curl -o cloud_sql_proxy https://dl.google.com/cloudsql/cloud_sql_proxy.$(uname | tr '[:upper:]' '[:lower:]').amd64
|
|
14
|
-
chmod +x cloud_sql_proxy
|
|
15
|
-
fi
|
|
16
|
-
|
|
17
|
-
instance="${dependency.instance.outputs.instance_connection_name}"
|
|
18
|
-
port="${local.proxy_port.locals.port}"
|
|
19
|
-
if pgrep -afx "./cloud_sql_proxy -instances=$instance=tcp:$port"; then
|
|
20
|
-
pkill -fx "./cloud_sql_proxy -instances=$instance=tcp:$port"
|
|
21
|
-
fi
|
|
22
|
-
echo "Starting cloud_sql_proxy for database"
|
|
23
|
-
screen -d -m ./cloud_sql_proxy -instances=$instance=tcp:$port
|
|
24
|
-
EOF
|
|
25
|
-
]
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
after_hook "cleanup_proxy" {
|
|
29
|
-
commands = ["apply", "plan"]
|
|
30
|
-
execute = ["sh", "-c",
|
|
31
|
-
<<-EOF
|
|
32
|
-
set -e
|
|
33
|
-
echo "Killing cloud_sql_proxy for database"
|
|
34
|
-
instance="${dependency.instance.outputs.instance_connection_name}"
|
|
35
|
-
port="${local.proxy_port.locals.port}"
|
|
36
|
-
pkill -fx "./cloud_sql_proxy -instances=$instance=tcp:$port"
|
|
37
|
-
EOF
|
|
38
|
-
]
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
include {
|
|
43
|
-
path = find_in_parent_folders("terragrunt_root.hcl")
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
dependency "instance" {
|
|
47
|
-
config_path = "../../instance"
|
|
48
|
-
mock_outputs = {
|
|
49
|
-
generated_user_password = "dummy-password"
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
locals {
|
|
54
|
-
db_name = basename(get_terragrunt_dir())
|
|
55
|
-
proxy_port = read_terragrunt_config("${get_terragrunt_dir()}/proxy_port.hcl")
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
# These are the variables we have to pass in to use the module specified in the terragrunt configuration above
|
|
59
|
-
inputs = merge(
|
|
60
|
-
{
|
|
61
|
-
# connect to cloudsql postgres instance through cloudsql proxy
|
|
62
|
-
host = "127.0.0.1"
|
|
63
|
-
port = local.proxy_port.locals.port
|
|
64
|
-
db_name = local.db_name
|
|
65
|
-
|
|
66
|
-
password = dependency.instance.outputs.generated_user_password
|
|
67
|
-
user = "${local.db_name}-admin"
|
|
68
|
-
}
|
|
69
|
-
)
|
package/generators/common-resources/cloudsql-database/templates/mysql/secrets/terragrunt.hcl
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# Terragrunt will copy the Terraform configurations specified by the source parameter, along with any files in the
|
|
2
|
-
# working directory, into a temporary folder, and execute your Terraform commands in that folder.
|
|
3
|
-
terraform {
|
|
4
|
-
source = "git::https://github.com/extenda/tf-module-gcp-secret-manager//?ref=v0.1.2"
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
include {
|
|
8
|
-
path = find_in_parent_folders("terragrunt_root.hcl")
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
locals {
|
|
12
|
-
project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
|
|
13
|
-
common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
|
|
14
|
-
labels = merge(local.common_vars.locals.default_user_labels, local.project_vars.locals.default_user_labels, {
|
|
15
|
-
component = local.common_vars.locals.component
|
|
16
|
-
product = local.common_vars.locals.product
|
|
17
|
-
tenant-alias = local.common_vars.locals.tenant_alias
|
|
18
|
-
terraform = ""
|
|
19
|
-
})
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
<%-dependencies%>
|
|
23
|
-
|
|
24
|
-
# These are the variables we have to pass in to use the module specified in the terragrunt configuration above
|
|
25
|
-
inputs = {
|
|
26
|
-
project_id = local.project_vars.locals.project_id
|
|
27
|
-
secrets = {<%-secrets%>
|
|
28
|
-
}
|
|
29
|
-
labels = local.labels
|
|
30
|
-
}
|