diff --git a/.github/release.yml b/.github/release.yml index c6d9cb1..421c43d 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -10,8 +10,8 @@ changelog: labels: - dependencies - - title: 🔩 Dependencies + - title: 🔩 Dependencies labels: - dependencies -# This file is managed by the osinfra-io/github-organization-management repository and should not be edited directly. \ No newline at end of file +# This file is managed by the osinfra-io/github-organization-management repository and should not be edited directly. diff --git a/.gitignore b/.gitignore index a543f04..4af90a9 100644 --- a/.gitignore +++ b/.gitignore @@ -18,9 +18,6 @@ crash.log # be included in version control. local.tfvars -# Provider.tf is used for local development of modules and shouldn't be added to repos. -provider.tf - # Ignore override files as they are usually used to override ressources locally override.tf override.tf.json diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 05e7141..a422cc7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,7 +11,7 @@ repos: - id: check-symlinks - repo: https://github.com/antonbabenko/pre-commit-terraform - rev: v1.96.1 + rev: v1.96.2 hooks: - id: terraform_fmt @@ -29,9 +29,11 @@ repos: - id: terraform_docs - repo: https://github.com/bridgecrewio/checkov.git - rev: 3.2.257 + rev: 3.2.296 hooks: - id: checkov verbose: true args: + - --skip-check + - "CKV_TF_1" - --quiet diff --git a/README.md b/README.md index 296af8e..602c58d 100644 --- a/README.md +++ b/README.md @@ -73,8 +73,8 @@ No requirements. | Name | Version | |------|---------| -| [google](#provider\_google) | 6.4.0 | -| [google-beta](#provider\_google-beta) | 6.4.0 | +| [google](#provider\_google) | 6.11.1 | +| [google-beta](#provider\_google-beta) | 6.11.1 | ### Modules diff --git a/regional/README.md b/regional/README.md index 939f748..ab12855 100644 --- a/regional/README.md +++ b/regional/README.md @@ -11,13 +11,15 @@ No requirements. | Name | Version | |------|---------| -| [google](#provider\_google) | 5.40.0 | -| [helm](#provider\_helm) | 2.14.1 | -| [kubernetes](#provider\_kubernetes) | 2.31.0 | +| [google](#provider\_google) | 6.11.1 | +| [helm](#provider\_helm) | 2.16.1 | +| [kubernetes](#provider\_kubernetes) | 2.33.0 | ## Modules -No modules. +| Name | Source | Version | +|------|--------|---------| +| [helpers](#module\_helpers) | github.com/osinfra-io/terraform-core-helpers//child | v0.1.2 | ## Resources @@ -54,7 +56,7 @@ No modules. | [gateway\_mci\_global\_address](#input\_gateway\_mci\_global\_address) | The IP address for the Istio Gateway multi-cluster ingress | `string` | `""` | no | | [gateway\_memory\_limits](#input\_gateway\_memory\_limits) | The memory limit for the Istio gateway | `string` | `"64Mi"` | no | | [gateway\_memory\_requests](#input\_gateway\_memory\_requests) | The memory request for the Istio gateway | `string` | `"32Mi"` | no | -| [istio\_version](#input\_istio\_version) | The version to install, this is used for the chart as well as the image tag | `string` | `"1.23.2"` | no | +| [istio\_version](#input\_istio\_version) | The version to install, this is used for the chart as well as the image tag | `string` | `"1.24.0"` | no | | [labels](#input\_labels) | A map of key/value pairs to assign to the resources being created | `map(string)` | `{}` | no | | [multi\_cluster\_service\_clusters](#input\_multi\_cluster\_service\_clusters) | List of clusters to be included in the MultiClusterService |
list(object({
link = string
}))
| `[]` | no | | [node\_location](#input\_node\_location) | The zone in which the cluster's nodes should be located. If not specified, the cluster's nodes are located across zones in the region | `string` | `null` | no | diff --git a/regional/helm/base.yml b/regional/helm/base.yml deleted file mode 100644 index 3fe1b08..0000000 --- a/regional/helm/base.yml +++ /dev/null @@ -1,2 +0,0 @@ -global: - platform: "gcp" diff --git a/regional/helm/istiod.yml b/regional/helm/istiod.yml index fbbc0ba..b5d27ce 100644 --- a/regional/helm/istiod.yml +++ b/regional/helm/istiod.yml @@ -7,6 +7,7 @@ meshConfig: accessLogFile: /dev/stdout defaultConfig: proxyMetadata: + GRPC_ENFORCE_ALPN_ENABLED: "false" # This can be removed once https://github.com/cert-manager/istio-csr/pull/422 is released ISTIO_META_DNS_CAPTURE: "true" ISTIO_META_DNS_AUTO_ALLOCATE: "true" diff --git a/regional/helpers.tf b/regional/helpers.tf new file mode 120000 index 0000000..404585d --- /dev/null +++ b/regional/helpers.tf @@ -0,0 +1 @@ +../shared/helpers.tf \ No newline at end of file diff --git a/regional/locals.tf b/regional/locals.tf index 2688749..208be33 100644 --- a/regional/locals.tf +++ b/regional/locals.tf @@ -2,23 +2,9 @@ # https://www.terraform.io/docs/language/values/locals.html locals { - env = lookup(local.env_map, local.environment, "none") - - environment = ( - terraform.workspace == "default" ? - "mock-environment" : - regex(".*-(?P[^-]+)$", terraform.workspace)["environment"] - ) - - env_map = { - "non-production" = "nonprod" - "production" = "prod" - "sandbox" = "sb" - } - gateway_helm_values = { "autoscaling.minReplicas" = var.gateway_autoscale_min - "labels.tags\\.datadoghq\\.com/env" = local.environment + "labels.tags\\.datadoghq\\.com/env" = module.helpers.environment "labels.tags\\.datadoghq\\.com/version" = var.istio_version "podAnnotations.apm\\.datadoghq\\.com/env" = local.istio_gateway_datadog_apm_env "podAnnotations.proxy\\.istio\\.io/config" = <[^-]+-[^-]+)", terraform.workspace)["region"] - ) - - zone = ( - terraform.workspace == "default" ? - "mock-zone" : - ( - regex("^(?P[^-]+-[^-]+)(?:-(?P[^-]+))?-.*$", terraform.workspace)["zone"] != "" ? - regex("^(?P[^-]+-[^-]+)(?:-(?P[^-]+))?-.*$", terraform.workspace)["zone"] : - null - ) - ) + multi_cluster_name = module.helpers.zone != null ? "${var.cluster_prefix}-${module.helpers.region}-${module.helpers.zone}-${module.helpers.env}" : "${var.cluster_prefix}-${module.helpers.region}-${module.helpers.env}" } diff --git a/regional/main.tf b/regional/main.tf index 6a71a14..93f00a4 100644 --- a/regional/main.tf +++ b/regional/main.tf @@ -6,7 +6,7 @@ resource "google_compute_global_address" "istio_gateway" { labels = var.labels - name = "istio-gateway-${local.region}" + name = "istio-gateway-${module.helpers.region}" project = var.project } @@ -33,10 +33,6 @@ resource "helm_release" "base" { namespace = "istio-system" repository = var.chart_repository - values = [ - file("${path.module}/helm/base.yml") - ] - version = var.istio_version } diff --git a/regional/manifests/README.md b/regional/manifests/README.md index 28a9697..2364ba9 100755 --- a/regional/manifests/README.md +++ b/regional/manifests/README.md @@ -9,11 +9,13 @@ No requirements. | Name | Version | |------|---------| -| [kubernetes](#provider\_kubernetes) | 2.32.0 | +| [kubernetes](#provider\_kubernetes) | 2.33.0 | ## Modules -No modules. +| Name | Source | Version | +|------|--------|---------| +| [helpers](#module\_helpers) | github.com/osinfra-io/terraform-core-helpers//child | v0.1.2 | ## Resources diff --git a/regional/manifests/helpers.tf b/regional/manifests/helpers.tf new file mode 120000 index 0000000..4be5464 --- /dev/null +++ b/regional/manifests/helpers.tf @@ -0,0 +1 @@ +../../shared/helpers.tf \ No newline at end of file diff --git a/regional/variables.tf b/regional/variables.tf index 001ea66..476cb96 100644 --- a/regional/variables.tf +++ b/regional/variables.tf @@ -72,7 +72,7 @@ variable "gateway_memory_requests" { variable "istio_version" { description = "The version to install, this is used for the chart as well as the image tag" type = string - default = "1.23.2" + default = "1.24.0" } variable "labels" { diff --git a/shared/helpers.tf b/shared/helpers.tf new file mode 100644 index 0000000..c14ea27 --- /dev/null +++ b/shared/helpers.tf @@ -0,0 +1,6 @@ +# Terraform Core Child Module Helpers (osinfra.io) +# https://github.com/osinfra-io/terraform-core-helpers + +module "helpers" { + source = "github.com/osinfra-io/terraform-core-helpers//child?ref=v0.1.2" +} diff --git a/tests/fixtures/default/locals.tf b/tests/fixtures/default/locals.tf deleted file mode 100644 index 39acd5e..0000000 --- a/tests/fixtures/default/locals.tf +++ /dev/null @@ -1,12 +0,0 @@ -# Local Values -# https://www.terraform.io/docs/language/values/locals.html - -locals { - labels = { - cost-center = "mock-x001" - env = "mock-environment" - repository = "mock-repository" - platform = "mock-platform" - team = "mock-team" - } -} diff --git a/tests/fixtures/default/main.tf b/tests/fixtures/default/main.tf index 2d75dd5..02c7e7f 100644 --- a/tests/fixtures/default/main.tf +++ b/tests/fixtures/default/main.tf @@ -16,6 +16,10 @@ module "test" { source = "../../../" gateway_dns = var.gateway_dns - labels = local.labels - project = var.project + + labels = { + "mock-key" = "mock-value" + } + + project = var.project } diff --git a/tests/fixtures/default/outputs.tf b/tests/fixtures/default/outputs.tf deleted file mode 100644 index 9717749..0000000 --- a/tests/fixtures/default/outputs.tf +++ /dev/null @@ -1,10 +0,0 @@ -# Output Values -# https://www.terraform.io/language/values/outputs - -output "gateway_mci_global_address" { - value = module.test.gateway_mci_global_address -} - -output "gateway_mci_ssl_certificate_name" { - value = module.test.gateway_mci_ssl_certificate_name -} diff --git a/tests/fixtures/default/regional/locals.tf b/tests/fixtures/default/regional/locals.tf deleted file mode 100644 index e72ad30..0000000 --- a/tests/fixtures/default/regional/locals.tf +++ /dev/null @@ -1,14 +0,0 @@ -# Local Values -# https://www.terraform.io/language/values/locals - -locals { - labels = { - cost-center = "mock-x001" - env = "mock-environment" - repository = "mock-repository" - platform = "mock-platform" - team = "mock-team" - } - - regional = data.terraform_remote_state.regional.outputs -} diff --git a/tests/fixtures/default/regional/main.tf b/tests/fixtures/default/regional/main.tf index e64a7e2..6494d83 100644 --- a/tests/fixtures/default/regional/main.tf +++ b/tests/fixtures/default/regional/main.tf @@ -15,51 +15,6 @@ terraform { } } -# Helm Provider -# https://registry.terraform.io/providers/hashicorp/helm/latest - -provider "helm" { - kubernetes { - - cluster_ca_certificate = base64decode( - local.regional.cluster_ca_certificate - ) - - host = local.regional.cluster_endpoint - token = data.google_client_config.current.access_token - } -} - -# Kubernetes Provider -# https://registry.terraform.io/providers/hashicorp/kubernetes/latest - -provider "kubernetes" { - cluster_ca_certificate = base64decode( - local.regional.cluster_ca_certificate - ) - - host = "https://${local.regional.cluster_endpoint}" - token = data.google_client_config.current.access_token -} - -# Google Client Config Data Source -# https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/client_config - -data "google_client_config" "current" { -} - -# Remote State Data Source -# https://www.terraform.io/language/state/remote-state-data - -data "terraform_remote_state" "regional" { - backend = "gcs" - workspace = "mock-workspace" - - config = { - bucket = "mock-bucket" - } -} - module "test" { source = "../../../../regional" @@ -67,7 +22,10 @@ module "test" { cluster_prefix = "mock" enable_istio_gateway = true gateway_dns = var.gateway_dns - labels = local.labels + + labels = { + "mock-key" = "mock-value" + } multi_cluster_service_clusters = [ {