diff --git a/README.md b/README.md index 9a7a6aa61..1997ee910 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,7 @@ Then perform the following commands on the root folder: | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| +| \_parent\_module | (Internal) Parent module which should be referenced in API calls. | `string` | `""` | no | | add\_cluster\_firewall\_rules | Create additional firewall rules | `bool` | `false` | no | | add\_shadow\_firewall\_rules | Create GKE shadow firewall (the same as default firewall rules with firewall logs enabled). | `bool` | `false` | no | | basic\_auth\_password | The password to be used with Basic Authentication. | `string` | `""` | no | diff --git a/autogen/main/variables.tf.tmpl b/autogen/main/variables.tf.tmpl index e84526f96..3dfd9e03c 100644 --- a/autogen/main/variables.tf.tmpl +++ b/autogen/main/variables.tf.tmpl @@ -625,3 +625,9 @@ variable "enable_tpu" { default = false } {% endif %} + +variable "_parent_module" { + type = string + description = "(Internal) Parent module which should be referenced in API calls." + default = "" +} diff --git a/autogen/main/versions.tf.tmpl b/autogen/main/versions.tf.tmpl index b682d80e6..3d7455651 100644 --- a/autogen/main/versions.tf.tmpl +++ b/autogen/main/versions.tf.tmpl @@ -17,6 +17,10 @@ {% set module_path_str = module_path|string %} {% set module_registry_name = module_path_str.split('/')[-1] %} +locals { + blueprint_name = join("/", compact([var._parent_module, "terraform-google-kubernetes-engine{% if module_registry_name %}:{{ module_registry_name }}{% endif %}/v13.0.0"])) +} + terraform { required_version = ">=0.13" @@ -32,7 +36,7 @@ terraform { } } provider_meta "google-beta" { - module_name = "blueprints/terraform/terraform-google-kubernetes-engine{% if module_registry_name %}:{{ module_registry_name }}{% endif %}/v13.0.0" + module_name = "blueprints/terraform/${local.blueprint_name}" } {% else %} required_providers { @@ -46,7 +50,7 @@ terraform { } } provider_meta "google" { - module_name = "blueprints/terraform/terraform-google-kubernetes-engine{% if module_registry_name %}:{{ module_registry_name }}{% endif %}/v13.0.0" + module_name = "blueprints/terraform/${local.blueprint_name}" } {% endif %} } diff --git a/autogen/safer-cluster/main.tf.tmpl b/autogen/safer-cluster/main.tf.tmpl index 7a871d372..bf79748cb 100644 --- a/autogen/safer-cluster/main.tf.tmpl +++ b/autogen/safer-cluster/main.tf.tmpl @@ -169,4 +169,6 @@ module "gke" { gce_pd_csi_driver = var.gce_pd_csi_driver notification_config_topic = var.notification_config_topic + + _parent_module = local.blueprint_name } diff --git a/autogen/safer-cluster/variables.tf.tmpl b/autogen/safer-cluster/variables.tf.tmpl index b64d63c7a..b978434d6 100644 --- a/autogen/safer-cluster/variables.tf.tmpl +++ b/autogen/safer-cluster/variables.tf.tmpl @@ -381,3 +381,9 @@ variable "notification_config_topic" { description = "The desired Pub/Sub topic to which notifications will be sent by GKE. Format is projects/{project}/topics/{topic}." default = "" } + +variable "_parent_module" { + type = string + description = "(Internal) Parent module which should be referenced in API calls." + default = "" +} diff --git a/autogen/safer-cluster/versions.tf.tmpl b/autogen/safer-cluster/versions.tf.tmpl index e5405fd3d..633c13b6e 100644 --- a/autogen/safer-cluster/versions.tf.tmpl +++ b/autogen/safer-cluster/versions.tf.tmpl @@ -19,10 +19,14 @@ {% set module_path_str = module_path|string %} {% set module_registry_name = module_path_str.split('/')[-1] %} +locals { + blueprint_name = join("/", compact([var._parent_module, "terraform-google-kubernetes-engine{% if module_registry_name %}:{{ module_registry_name }}{% endif %}/v13.0.0"])) +} + terraform { required_version = ">=0.13" provider_meta "google-beta" { - module_name = "blueprints/terraform/terraform-google-kubernetes-engine{% if module_registry_name %}:{{ module_registry_name }}{% endif %}/v13.0.0" + module_name = "blueprints/terraform/${local.blueprint_name}" } } diff --git a/examples/safer_cluster/README.md b/examples/safer_cluster/README.md index 5c483558b..556008e95 100644 --- a/examples/safer_cluster/README.md +++ b/examples/safer_cluster/README.md @@ -7,7 +7,6 @@ This example illustrates how to instantiate the opinionated Safer Cluster module | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| -| compute\_engine\_service\_account | Service account to associate to the nodes in the cluster | `string` | n/a | yes | | project\_id | The project ID to host the cluster in | `string` | n/a | yes | | region | The region to host the cluster in | `string` | `"us-central1"` | no | diff --git a/examples/safer_cluster/main.tf b/examples/safer_cluster/main.tf index bf5dad706..7fd06bafd 100644 --- a/examples/safer_cluster/main.tf +++ b/examples/safer_cluster/main.tf @@ -48,19 +48,18 @@ provider "kubernetes" { } module "gke" { - source = "../../modules/safer-cluster/" - project_id = var.project_id - name = "${local.cluster_type}-cluster-${random_string.suffix.result}" - regional = true - region = var.region - network = module.gcp-network.network_name - subnetwork = local.subnet_names[index(module.gcp-network.subnets_names, local.subnet_name)] - ip_range_pods = local.pods_range_name - ip_range_services = local.svc_range_name - compute_engine_service_account = var.compute_engine_service_account - master_ipv4_cidr_block = "172.16.0.0/28" - add_cluster_firewall_rules = true - firewall_inbound_ports = ["9443", "15017"] + source = "../../modules/safer-cluster/" + project_id = var.project_id + name = "${local.cluster_type}-cluster-${random_string.suffix.result}" + regional = true + region = var.region + network = module.gcp-network.network_name + subnetwork = local.subnet_names[index(module.gcp-network.subnets_names, local.subnet_name)] + ip_range_pods = local.pods_range_name + ip_range_services = local.svc_range_name + master_ipv4_cidr_block = "172.16.0.0/28" + add_cluster_firewall_rules = true + firewall_inbound_ports = ["9443", "15017"] master_authorized_networks = [ { diff --git a/examples/safer_cluster/variables.tf b/examples/safer_cluster/variables.tf index dc3c20889..0ffbb235d 100644 --- a/examples/safer_cluster/variables.tf +++ b/examples/safer_cluster/variables.tf @@ -24,8 +24,3 @@ variable "region" { description = "The region to host the cluster in" default = "us-central1" } - -variable "compute_engine_service_account" { - type = string - description = "Service account to associate to the nodes in the cluster" -} diff --git a/modules/beta-private-cluster-update-variant/README.md b/modules/beta-private-cluster-update-variant/README.md index d1a9a53c5..3e99c2e7a 100644 --- a/modules/beta-private-cluster-update-variant/README.md +++ b/modules/beta-private-cluster-update-variant/README.md @@ -154,6 +154,7 @@ Then perform the following commands on the root folder: | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| +| \_parent\_module | (Internal) Parent module which should be referenced in API calls. | `string` | `""` | no | | add\_cluster\_firewall\_rules | Create additional firewall rules | `bool` | `false` | no | | add\_shadow\_firewall\_rules | Create GKE shadow firewall (the same as default firewall rules with firewall logs enabled). | `bool` | `false` | no | | authenticator\_security\_group | The name of the RBAC security group for use with Google security groups in Kubernetes RBAC. Group name must be in format gke-security-groups@yourdomain.com | `string` | `null` | no | diff --git a/modules/beta-private-cluster-update-variant/variables.tf b/modules/beta-private-cluster-update-variant/variables.tf index 8dd21d53e..b9cbdab3a 100644 --- a/modules/beta-private-cluster-update-variant/variables.tf +++ b/modules/beta-private-cluster-update-variant/variables.tf @@ -603,3 +603,9 @@ variable "enable_tpu" { description = "Enable Cloud TPU resources in the cluster. WARNING: changing this after cluster creation is destructive!" default = false } + +variable "_parent_module" { + type = string + description = "(Internal) Parent module which should be referenced in API calls." + default = "" +} diff --git a/modules/beta-private-cluster-update-variant/versions.tf b/modules/beta-private-cluster-update-variant/versions.tf index d74708615..5740604f1 100644 --- a/modules/beta-private-cluster-update-variant/versions.tf +++ b/modules/beta-private-cluster-update-variant/versions.tf @@ -15,6 +15,10 @@ */ +locals { + blueprint_name = join("/", compact([var._parent_module, "terraform-google-kubernetes-engine:beta-private-cluster-update-variant/v13.0.0"])) +} + terraform { required_version = ">=0.13" @@ -29,6 +33,6 @@ terraform { } } provider_meta "google-beta" { - module_name = "blueprints/terraform/terraform-google-kubernetes-engine:beta-private-cluster-update-variant/v13.0.0" + module_name = "blueprints/terraform/${local.blueprint_name}" } } diff --git a/modules/beta-private-cluster/README.md b/modules/beta-private-cluster/README.md index c46bfce55..32afa72fe 100644 --- a/modules/beta-private-cluster/README.md +++ b/modules/beta-private-cluster/README.md @@ -132,6 +132,7 @@ Then perform the following commands on the root folder: | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| +| \_parent\_module | (Internal) Parent module which should be referenced in API calls. | `string` | `""` | no | | add\_cluster\_firewall\_rules | Create additional firewall rules | `bool` | `false` | no | | add\_shadow\_firewall\_rules | Create GKE shadow firewall (the same as default firewall rules with firewall logs enabled). | `bool` | `false` | no | | authenticator\_security\_group | The name of the RBAC security group for use with Google security groups in Kubernetes RBAC. Group name must be in format gke-security-groups@yourdomain.com | `string` | `null` | no | diff --git a/modules/beta-private-cluster/variables.tf b/modules/beta-private-cluster/variables.tf index 8dd21d53e..b9cbdab3a 100644 --- a/modules/beta-private-cluster/variables.tf +++ b/modules/beta-private-cluster/variables.tf @@ -603,3 +603,9 @@ variable "enable_tpu" { description = "Enable Cloud TPU resources in the cluster. WARNING: changing this after cluster creation is destructive!" default = false } + +variable "_parent_module" { + type = string + description = "(Internal) Parent module which should be referenced in API calls." + default = "" +} diff --git a/modules/beta-private-cluster/versions.tf b/modules/beta-private-cluster/versions.tf index daed13051..ae3c6395a 100644 --- a/modules/beta-private-cluster/versions.tf +++ b/modules/beta-private-cluster/versions.tf @@ -15,6 +15,10 @@ */ +locals { + blueprint_name = join("/", compact([var._parent_module, "terraform-google-kubernetes-engine:beta-private-cluster/v13.0.0"])) +} + terraform { required_version = ">=0.13" @@ -29,6 +33,6 @@ terraform { } } provider_meta "google-beta" { - module_name = "blueprints/terraform/terraform-google-kubernetes-engine:beta-private-cluster/v13.0.0" + module_name = "blueprints/terraform/${local.blueprint_name}" } } diff --git a/modules/beta-public-cluster-update-variant/README.md b/modules/beta-public-cluster-update-variant/README.md index 875967d82..eca813cc9 100644 --- a/modules/beta-public-cluster-update-variant/README.md +++ b/modules/beta-public-cluster-update-variant/README.md @@ -148,6 +148,7 @@ Then perform the following commands on the root folder: | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| +| \_parent\_module | (Internal) Parent module which should be referenced in API calls. | `string` | `""` | no | | add\_cluster\_firewall\_rules | Create additional firewall rules | `bool` | `false` | no | | add\_shadow\_firewall\_rules | Create GKE shadow firewall (the same as default firewall rules with firewall logs enabled). | `bool` | `false` | no | | authenticator\_security\_group | The name of the RBAC security group for use with Google security groups in Kubernetes RBAC. Group name must be in format gke-security-groups@yourdomain.com | `string` | `null` | no | diff --git a/modules/beta-public-cluster-update-variant/variables.tf b/modules/beta-public-cluster-update-variant/variables.tf index 2d4f27d88..fc59b854f 100644 --- a/modules/beta-public-cluster-update-variant/variables.tf +++ b/modules/beta-public-cluster-update-variant/variables.tf @@ -572,3 +572,9 @@ variable "enable_tpu" { description = "Enable Cloud TPU resources in the cluster. WARNING: changing this after cluster creation is destructive!" default = false } + +variable "_parent_module" { + type = string + description = "(Internal) Parent module which should be referenced in API calls." + default = "" +} diff --git a/modules/beta-public-cluster-update-variant/versions.tf b/modules/beta-public-cluster-update-variant/versions.tf index 0a40ff5a6..589dc8552 100644 --- a/modules/beta-public-cluster-update-variant/versions.tf +++ b/modules/beta-public-cluster-update-variant/versions.tf @@ -15,6 +15,10 @@ */ +locals { + blueprint_name = join("/", compact([var._parent_module, "terraform-google-kubernetes-engine:beta-public-cluster-update-variant/v13.0.0"])) +} + terraform { required_version = ">=0.13" @@ -29,6 +33,6 @@ terraform { } } provider_meta "google-beta" { - module_name = "blueprints/terraform/terraform-google-kubernetes-engine:beta-public-cluster-update-variant/v13.0.0" + module_name = "blueprints/terraform/${local.blueprint_name}" } } diff --git a/modules/beta-public-cluster/README.md b/modules/beta-public-cluster/README.md index ca6f5fe25..65b5e790a 100644 --- a/modules/beta-public-cluster/README.md +++ b/modules/beta-public-cluster/README.md @@ -126,6 +126,7 @@ Then perform the following commands on the root folder: | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| +| \_parent\_module | (Internal) Parent module which should be referenced in API calls. | `string` | `""` | no | | add\_cluster\_firewall\_rules | Create additional firewall rules | `bool` | `false` | no | | add\_shadow\_firewall\_rules | Create GKE shadow firewall (the same as default firewall rules with firewall logs enabled). | `bool` | `false` | no | | authenticator\_security\_group | The name of the RBAC security group for use with Google security groups in Kubernetes RBAC. Group name must be in format gke-security-groups@yourdomain.com | `string` | `null` | no | diff --git a/modules/beta-public-cluster/variables.tf b/modules/beta-public-cluster/variables.tf index 2d4f27d88..fc59b854f 100644 --- a/modules/beta-public-cluster/variables.tf +++ b/modules/beta-public-cluster/variables.tf @@ -572,3 +572,9 @@ variable "enable_tpu" { description = "Enable Cloud TPU resources in the cluster. WARNING: changing this after cluster creation is destructive!" default = false } + +variable "_parent_module" { + type = string + description = "(Internal) Parent module which should be referenced in API calls." + default = "" +} diff --git a/modules/beta-public-cluster/versions.tf b/modules/beta-public-cluster/versions.tf index 51a54d823..6c633a1f3 100644 --- a/modules/beta-public-cluster/versions.tf +++ b/modules/beta-public-cluster/versions.tf @@ -15,6 +15,10 @@ */ +locals { + blueprint_name = join("/", compact([var._parent_module, "terraform-google-kubernetes-engine:beta-public-cluster/v13.0.0"])) +} + terraform { required_version = ">=0.13" @@ -29,6 +33,6 @@ terraform { } } provider_meta "google-beta" { - module_name = "blueprints/terraform/terraform-google-kubernetes-engine:beta-public-cluster/v13.0.0" + module_name = "blueprints/terraform/${local.blueprint_name}" } } diff --git a/modules/private-cluster-update-variant/README.md b/modules/private-cluster-update-variant/README.md index 75a2a272c..be0359347 100644 --- a/modules/private-cluster-update-variant/README.md +++ b/modules/private-cluster-update-variant/README.md @@ -151,6 +151,7 @@ Then perform the following commands on the root folder: | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| +| \_parent\_module | (Internal) Parent module which should be referenced in API calls. | `string` | `""` | no | | add\_cluster\_firewall\_rules | Create additional firewall rules | `bool` | `false` | no | | add\_shadow\_firewall\_rules | Create GKE shadow firewall (the same as default firewall rules with firewall logs enabled). | `bool` | `false` | no | | basic\_auth\_password | The password to be used with Basic Authentication. | `string` | `""` | no | diff --git a/modules/private-cluster-update-variant/variables.tf b/modules/private-cluster-update-variant/variables.tf index 51ad164f6..3131f26fa 100644 --- a/modules/private-cluster-update-variant/variables.tf +++ b/modules/private-cluster-update-variant/variables.tf @@ -474,3 +474,9 @@ variable "impersonate_service_account" { default = "" } + +variable "_parent_module" { + type = string + description = "(Internal) Parent module which should be referenced in API calls." + default = "" +} diff --git a/modules/private-cluster-update-variant/versions.tf b/modules/private-cluster-update-variant/versions.tf index 616f80683..872fa1b38 100644 --- a/modules/private-cluster-update-variant/versions.tf +++ b/modules/private-cluster-update-variant/versions.tf @@ -15,6 +15,10 @@ */ +locals { + blueprint_name = join("/", compact([var._parent_module, "terraform-google-kubernetes-engine:private-cluster-update-variant/v13.0.0"])) +} + terraform { required_version = ">=0.13" @@ -29,6 +33,6 @@ terraform { } } provider_meta "google" { - module_name = "blueprints/terraform/terraform-google-kubernetes-engine:private-cluster-update-variant/v13.0.0" + module_name = "blueprints/terraform/${local.blueprint_name}" } } diff --git a/modules/private-cluster/README.md b/modules/private-cluster/README.md index 3630ba796..88981d751 100644 --- a/modules/private-cluster/README.md +++ b/modules/private-cluster/README.md @@ -129,6 +129,7 @@ Then perform the following commands on the root folder: | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| +| \_parent\_module | (Internal) Parent module which should be referenced in API calls. | `string` | `""` | no | | add\_cluster\_firewall\_rules | Create additional firewall rules | `bool` | `false` | no | | add\_shadow\_firewall\_rules | Create GKE shadow firewall (the same as default firewall rules with firewall logs enabled). | `bool` | `false` | no | | basic\_auth\_password | The password to be used with Basic Authentication. | `string` | `""` | no | diff --git a/modules/private-cluster/variables.tf b/modules/private-cluster/variables.tf index 51ad164f6..3131f26fa 100644 --- a/modules/private-cluster/variables.tf +++ b/modules/private-cluster/variables.tf @@ -474,3 +474,9 @@ variable "impersonate_service_account" { default = "" } + +variable "_parent_module" { + type = string + description = "(Internal) Parent module which should be referenced in API calls." + default = "" +} diff --git a/modules/private-cluster/versions.tf b/modules/private-cluster/versions.tf index ab8ef94cb..1592ed32a 100644 --- a/modules/private-cluster/versions.tf +++ b/modules/private-cluster/versions.tf @@ -15,6 +15,10 @@ */ +locals { + blueprint_name = join("/", compact([var._parent_module, "terraform-google-kubernetes-engine:private-cluster/v13.0.0"])) +} + terraform { required_version = ">=0.13" @@ -29,6 +33,6 @@ terraform { } } provider_meta "google" { - module_name = "blueprints/terraform/terraform-google-kubernetes-engine:private-cluster/v13.0.0" + module_name = "blueprints/terraform/${local.blueprint_name}" } } diff --git a/modules/safer-cluster-update-variant/README.md b/modules/safer-cluster-update-variant/README.md index f6b997eba..99e42298f 100644 --- a/modules/safer-cluster-update-variant/README.md +++ b/modules/safer-cluster-update-variant/README.md @@ -201,6 +201,7 @@ For simplicity, we suggest using `roles/container.admin` and | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| +| \_parent\_module | (Internal) Parent module which should be referenced in API calls. | `string` | `""` | no | | add\_cluster\_firewall\_rules | Create additional firewall rules | `bool` | `false` | no | | authenticator\_security\_group | The name of the RBAC security group for use with Google security groups in Kubernetes RBAC. Group name must be in format gke-security-groups@yourdomain.com | `string` | `null` | no | | cloudrun | (Beta) Enable CloudRun addon | `bool` | `false` | no | diff --git a/modules/safer-cluster-update-variant/main.tf b/modules/safer-cluster-update-variant/main.tf index 1a9be43bc..97be992c8 100644 --- a/modules/safer-cluster-update-variant/main.tf +++ b/modules/safer-cluster-update-variant/main.tf @@ -165,4 +165,6 @@ module "gke" { gce_pd_csi_driver = var.gce_pd_csi_driver notification_config_topic = var.notification_config_topic + + _parent_module = local.blueprint_name } diff --git a/modules/safer-cluster-update-variant/variables.tf b/modules/safer-cluster-update-variant/variables.tf index 6ac893416..e64b3fb75 100644 --- a/modules/safer-cluster-update-variant/variables.tf +++ b/modules/safer-cluster-update-variant/variables.tf @@ -381,3 +381,9 @@ variable "notification_config_topic" { description = "The desired Pub/Sub topic to which notifications will be sent by GKE. Format is projects/{project}/topics/{topic}." default = "" } + +variable "_parent_module" { + type = string + description = "(Internal) Parent module which should be referenced in API calls." + default = "" +} diff --git a/modules/safer-cluster-update-variant/versions.tf b/modules/safer-cluster-update-variant/versions.tf index 3a81d551f..99b46f109 100644 --- a/modules/safer-cluster-update-variant/versions.tf +++ b/modules/safer-cluster-update-variant/versions.tf @@ -17,10 +17,14 @@ // This file was automatically generated from a template in ./autogen/safer-cluster +locals { + blueprint_name = join("/", compact([var._parent_module, "terraform-google-kubernetes-engine:safer-cluster-update-variant/v13.0.0"])) +} + terraform { required_version = ">=0.13" provider_meta "google-beta" { - module_name = "blueprints/terraform/terraform-google-kubernetes-engine:safer-cluster-update-variant/v13.0.0" + module_name = "blueprints/terraform/${local.blueprint_name}" } } diff --git a/modules/safer-cluster/README.md b/modules/safer-cluster/README.md index f6b997eba..99e42298f 100644 --- a/modules/safer-cluster/README.md +++ b/modules/safer-cluster/README.md @@ -201,6 +201,7 @@ For simplicity, we suggest using `roles/container.admin` and | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| +| \_parent\_module | (Internal) Parent module which should be referenced in API calls. | `string` | `""` | no | | add\_cluster\_firewall\_rules | Create additional firewall rules | `bool` | `false` | no | | authenticator\_security\_group | The name of the RBAC security group for use with Google security groups in Kubernetes RBAC. Group name must be in format gke-security-groups@yourdomain.com | `string` | `null` | no | | cloudrun | (Beta) Enable CloudRun addon | `bool` | `false` | no | diff --git a/modules/safer-cluster/main.tf b/modules/safer-cluster/main.tf index c61689b09..49731d5b2 100644 --- a/modules/safer-cluster/main.tf +++ b/modules/safer-cluster/main.tf @@ -165,4 +165,6 @@ module "gke" { gce_pd_csi_driver = var.gce_pd_csi_driver notification_config_topic = var.notification_config_topic + + _parent_module = local.blueprint_name } diff --git a/modules/safer-cluster/variables.tf b/modules/safer-cluster/variables.tf index 6ac893416..e64b3fb75 100644 --- a/modules/safer-cluster/variables.tf +++ b/modules/safer-cluster/variables.tf @@ -381,3 +381,9 @@ variable "notification_config_topic" { description = "The desired Pub/Sub topic to which notifications will be sent by GKE. Format is projects/{project}/topics/{topic}." default = "" } + +variable "_parent_module" { + type = string + description = "(Internal) Parent module which should be referenced in API calls." + default = "" +} diff --git a/modules/safer-cluster/versions.tf b/modules/safer-cluster/versions.tf index 69f2393d5..1ebf37c80 100644 --- a/modules/safer-cluster/versions.tf +++ b/modules/safer-cluster/versions.tf @@ -17,10 +17,14 @@ // This file was automatically generated from a template in ./autogen/safer-cluster +locals { + blueprint_name = join("/", compact([var._parent_module, "terraform-google-kubernetes-engine:safer-cluster/v13.0.0"])) +} + terraform { required_version = ">=0.13" provider_meta "google-beta" { - module_name = "blueprints/terraform/terraform-google-kubernetes-engine:safer-cluster/v13.0.0" + module_name = "blueprints/terraform/${local.blueprint_name}" } } diff --git a/test/fixtures/safer_cluster/example.tf b/test/fixtures/safer_cluster/example.tf index 8cd7983c2..48d6b59c8 100644 --- a/test/fixtures/safer_cluster/example.tf +++ b/test/fixtures/safer_cluster/example.tf @@ -17,7 +17,6 @@ module "example" { source = "../../../examples/safer_cluster" - project_id = var.project_ids[0] - region = var.region - compute_engine_service_account = var.compute_engine_service_accounts[0] + project_id = var.project_ids[0] + region = var.region } diff --git a/variables.tf b/variables.tf index 1fe54753c..a386da2fc 100644 --- a/variables.tf +++ b/variables.tf @@ -450,3 +450,9 @@ variable "impersonate_service_account" { default = "" } + +variable "_parent_module" { + type = string + description = "(Internal) Parent module which should be referenced in API calls." + default = "" +} diff --git a/versions.tf b/versions.tf index 4b6f695a5..25abde584 100644 --- a/versions.tf +++ b/versions.tf @@ -15,6 +15,10 @@ */ +locals { + blueprint_name = join("/", compact([var._parent_module, "terraform-google-kubernetes-engine/v13.0.0"])) +} + terraform { required_version = ">=0.13" @@ -29,6 +33,6 @@ terraform { } } provider_meta "google" { - module_name = "blueprints/terraform/terraform-google-kubernetes-engine/v13.0.0" + module_name = "blueprints/terraform/${local.blueprint_name}" } }