Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make workload_identity_config dynamic #237

Merged
merged 9 commits into from
Aug 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -389,3 +389,4 @@ command.
[terraform-provider-google]: https://github.com/terraform-providers/terraform-provider-google
[3.0.0]: https://registry.terraform.io/modules/terraform-google-modules/kubernetes-engine/google/3.0.0
[terraform-0.12-upgrade]: https://www.terraform.io/upgrade-guides/0-12.html

8 changes: 6 additions & 2 deletions autogen/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,12 @@ resource "google_container_cluster" "primary" {
}
}

workload_identity_config {
identity_namespace = var.identity_namespace
dynamic "workload_identity_config" {
for_each = local.cluster_workload_identity_config

content {
identity_namespace = workload_identity_config.value.identity_namespace
}
}
{% endif %}
}
Expand Down
3 changes: 3 additions & 0 deletions autogen/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ locals {
cluster_pod_security_policy_enabled = local.cluster_output_pod_security_policy_enabled
cluster_intranode_visibility_enabled = local.cluster_output_intranode_visbility_enabled
cluster_vertical_pod_autoscaling_enabled = local.cluster_output_vertical_pod_autoscaling_enabled
cluster_workload_identity_config = var.identity_namespace == "" ? [] : [{
identity_namespace = var.identity_namespace
}]
# /BETA features
{% endif %}
}
Expand Down
3 changes: 2 additions & 1 deletion autogen/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,10 @@ variable "enable_intranode_visibility" {
}

variable "identity_namespace" {
type = string
description = "Workload Identity namespace"
type = string
default = ""
}


{% endif %}
4 changes: 2 additions & 2 deletions examples/deploy_service/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ locals {
}

provider "google" {
version = "~> 2.9.0"
version = "~> 2.12.0"
region = var.region
}

provider "google-beta" {
version = "~> 2.9.0"
version = "~> 2.12.0"
region = var.region
}

Expand Down
4 changes: 2 additions & 2 deletions examples/disable_client_cert/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ locals {
}

provider "google" {
version = "~> 2.9.0"
version = "~> 2.12.0"
region = var.region
}

provider "google-beta" {
version = "~> 2.9.0"
version = "~> 2.12.0"
region = var.region
}

Expand Down
4 changes: 2 additions & 2 deletions examples/node_pool/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ locals {
}

provider "google" {
version = "~> 2.9.0"
version = "~> 2.12.0"
region = var.region
}

provider "google-beta" {
version = "~> 2.9.0"
version = "~> 2.12.0"
region = var.region
}

Expand Down
4 changes: 2 additions & 2 deletions examples/shared_vpc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ locals {
}

provider "google" {
version = "~> 2.9.0"
version = "~> 2.12.0"
region = var.region
}

provider "google-beta" {
version = "~> 2.9.0"
version = "~> 2.12.0"
region = var.region
}

Expand Down
4 changes: 2 additions & 2 deletions examples/simple_regional/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ locals {
}

provider "google" {
version = "~> 2.9.0"
version = "~> 2.12.0"
region = var.region
}

provider "google-beta" {
version = "~> 2.9.0"
version = "~> 2.12.0"
region = var.region
}

Expand Down
4 changes: 2 additions & 2 deletions examples/simple_regional_beta/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ locals {
}

provider "google" {
version = "~> 2.9.0"
version = "~> 2.12.0"
credentials = file(var.credentials_path)
region = var.region
}

provider "google-beta" {
version = "~> 2.9.0"
version = "~> 2.12.0"
credentials = file(var.credentials_path)
region = var.region
}
Expand Down
2 changes: 1 addition & 1 deletion examples/simple_regional_private/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ locals {
}

provider "google-beta" {
version = "~> 2.9.0"
version = "~> 2.12.0"
region = var.region
}

Expand Down
2 changes: 1 addition & 1 deletion examples/simple_regional_private_beta/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ locals {
}

provider "google-beta" {
version = "~> 2.9.0"
version = "~> 2.12.0"
credentials = file(var.credentials_path)
region = var.region
}
Expand Down
4 changes: 2 additions & 2 deletions examples/simple_zonal/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ locals {
}

provider "google" {
version = "~> 2.9.0"
version = "~> 2.12.0"
region = var.region
}

provider "google-beta" {
version = "~> 2.9.0"
version = "~> 2.12.0"
region = var.region
}

Expand Down
2 changes: 1 addition & 1 deletion examples/simple_zonal_private/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ locals {
}

provider "google-beta" {
version = "~> 2.9.0"
version = "~> 2.12.0"
region = var.region
}

Expand Down
4 changes: 2 additions & 2 deletions examples/stub_domains/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ locals {
}

provider "google" {
version = "~> 2.9.0"
version = "~> 2.12.0"
region = var.region
}

provider "google-beta" {
version = "~> 2.9.0"
version = "~> 2.12.0"
region = var.region
}

Expand Down
2 changes: 1 addition & 1 deletion examples/stub_domains_private/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

provider "google-beta" {
version = "~> 2.9.0"
version = "~> 2.12.0"
region = var.region
}

Expand Down
4 changes: 2 additions & 2 deletions examples/stub_domains_upstream_nameservers/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ locals {
}

provider "google" {
version = "~> 2.9.0"
version = "~> 2.12.0"
region = var.region
}

provider "google-beta" {
version = "~> 2.9.0"
version = "~> 2.12.0"
region = var.region
}

Expand Down
4 changes: 2 additions & 2 deletions examples/upstream_nameservers/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ locals {
}

provider "google" {
version = "~> 2.9.0"
version = "~> 2.12.0"
region = var.region
}

provider "google-beta" {
version = "~> 2.9.0"
version = "~> 2.12.0"
region = var.region
}

Expand Down
2 changes: 1 addition & 1 deletion examples/workload_metadata_config/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ locals {
}

provider "google-beta" {
version = "~> 2.9.0"
version = "~> 2.12.0"
region = var.region
}

Expand Down
8 changes: 6 additions & 2 deletions modules/beta-private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,12 @@ resource "google_container_cluster" "primary" {
}
}

workload_identity_config {
identity_namespace = var.identity_namespace
dynamic "workload_identity_config" {
for_each = local.cluster_workload_identity_config

content {
identity_namespace = workload_identity_config.value.identity_namespace
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions modules/beta-private-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ locals {
cluster_pod_security_policy_enabled = local.cluster_output_pod_security_policy_enabled
cluster_intranode_visibility_enabled = local.cluster_output_intranode_visbility_enabled
cluster_vertical_pod_autoscaling_enabled = local.cluster_output_vertical_pod_autoscaling_enabled
cluster_workload_identity_config = var.identity_namespace == "" ? [] : [{
identity_namespace = var.identity_namespace
}]
# /BETA features
}

Expand Down
3 changes: 2 additions & 1 deletion modules/beta-private-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,9 @@ variable "enable_vertical_pod_autoscaling" {
}

variable "identity_namespace" {
type = string
description = "Workload Identity namespace"
type = string
default = ""
}


8 changes: 6 additions & 2 deletions modules/beta-public-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,12 @@ resource "google_container_cluster" "primary" {
}
}

workload_identity_config {
identity_namespace = var.identity_namespace
dynamic "workload_identity_config" {
for_each = local.cluster_workload_identity_config

content {
identity_namespace = workload_identity_config.value.identity_namespace
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions modules/beta-public-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ locals {
cluster_pod_security_policy_enabled = local.cluster_output_pod_security_policy_enabled
cluster_intranode_visibility_enabled = local.cluster_output_intranode_visbility_enabled
cluster_vertical_pod_autoscaling_enabled = local.cluster_output_vertical_pod_autoscaling_enabled
cluster_workload_identity_config = var.identity_namespace == "" ? [] : [{
identity_namespace = var.identity_namespace
}]
# /BETA features
}

Expand Down
3 changes: 2 additions & 1 deletion modules/beta-public-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,9 @@ variable "enable_vertical_pod_autoscaling" {
}

variable "identity_namespace" {
type = string
description = "Workload Identity namespace"
type = string
default = ""
}