diff --git a/infrastructure/base/.terraform.lock.hcl b/infrastructure/base/.terraform.lock.hcl index 3cf1effee..67e20f5be 100644 --- a/infrastructure/base/.terraform.lock.hcl +++ b/infrastructure/base/.terraform.lock.hcl @@ -2,44 +2,42 @@ # Manual edits may be lost in future updates. provider "registry.terraform.io/hashicorp/google" { - version = "4.26.0" - constraints = "~> 4.20" + version = "5.7.0" + constraints = "~> 5.7" hashes = [ - "h1:vrB5NhkzFu+dFiXcxGK1waeSYkqRFW4ZySgiq2js9Nk=", - "h1:xV+vg4tjH1G9GHYUkfuN3SVSC47G9NoQfQDbZmN2KCo=", - "zh:142ce66a1fd0f916d95eaaf3d8edbc818749bb7db1fe3fb9985b1150a01b6656", - "zh:17b9176fcf3109e64c57f61c32f98fc911777f4756da89f9c4bc2de9c0475592", - "zh:466ecc7451d859cbbbd25d251d7246bf813e168e26df843600c1c949f2bd6eaf", - "zh:57fcc1a9c26478356aee9ac34ba33b1a791f57d9dfd3409e421bedc94dbae938", - "zh:68750e29336e44d36facfdff6b0cd296b32e24e2aaded8cfeb8837ed1b706212", - "zh:8a2cf34a240c0bc0b04defc5bffc0bafabee323ec6d407f4ea0c12af171050e7", - "zh:91d9c9e8e3e961799691536565b6c33d1bc965f85c52913847f3a3fd8accecf6", - "zh:9a0c6b94467211f59d5069e3c79cb43dbb1d8fb0f61a9acfeccd24f5a0278918", - "zh:9a0df22fac3aecc2f0623e843c87680a07c460501508c4e32b0cc9f6e473ca2a", - "zh:bba9dfcf29f2ef541f9ae9cdc742e6c02f1262923f1d4c946c4b6e3d19e4346d", - "zh:e33d35fa18ba4effafdf0cf97794498cb4407a9a7c8edb2cec8a825ca94eb0f3", + "h1:27EAcEv0G2mV1ohhDWsz/nx6l15+uOYkPBzJgASXRQo=", + "zh:0c0cf15cc034d5f92cc1cd5ee4615012553a674b69ee1802e46c4b87f1c339aa", + "zh:28e64a798320866c4dc84c323b66eef94ec98043dba016cf01d6adbe2dc85de4", + "zh:3b6e6443a9000354f93682d847737d6e9f702a77c53a492a39b200134b3e8dfd", + "zh:3ed6af130702d9da8fc14f94b3b2c9a93917cda31d50d934dd6de0ca48044572", + "zh:784a0feae2a48aa9a63fe6feb86ad29e8d35647fa29eb42303b799f09ee92060", + "zh:828e0198d99b7f9e53994470d6b51012566660a560da9c8266d1eaf2b140635c", + "zh:8dcb7537d95ec14e75ca71cfce62323682ce0fb453902dc9f890b7c524a915d3", + "zh:a7e760dc5707603091a0c3de0d47d6f8e51d8cce523b5c90587b05f113c5e09c", + "zh:b5c79a5e5b9bcaf0158f5f704d31cf90fb93826085151f06dfc3ef48276ed17a", + "zh:c44a2726dcfbf7d538aa0d5abd2473108f625d1d82485a340e62dfc04043288f", + "zh:f4da66ba04847138949a6a178b8836182f7960e9d069bfe76f1203d9af99cd22", "zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c", ] } provider "registry.terraform.io/hashicorp/google-beta" { - version = "4.26.0" - constraints = "~> 4.20" + version = "5.7.0" + constraints = "~> 5.7" hashes = [ - "h1:/vQfEsILptD1/urOWC+TcQg89ifKDvI7weZEszGLI2E=", - "h1:uuLM13A87Zdpq/I1FV2PjWmXwZRBkwupc+nkiJx2LH8=", - "zh:0122996e6d27ee9c319bc7c90d61aa1365f3fbf30a39ed4ca48e12daad46a5f0", - "zh:14163b2309a689c1cd336e4b7d946f155220845216d4d548f0e655ba8f2fd5f9", - "zh:3c66947bc92c8eb9e44677d692ac42f28ad6a9279e7ae27a854278eb800c4097", - "zh:4b29c58e3580ec571477b93afc9a13f940340fa889f1d21ae3ae4a5d9cbebc35", - "zh:8557cff30ced68eb0d6c192f5209080c6c90c727d78eb36cbad61e1a37ff7a87", - "zh:b2d34ed618c371cb7145a9f842a6d6b1cd069963cfa38b83b0fb24dae755ad1d", - "zh:cbfcc05f7219d404986404b2a01633767d543fbe136e250a5e64dd48b56cb4d3", - "zh:eff6cdb15c459dc237419498e42477c26cb5c6082edf821a6fd1199548e9c4c2", - "zh:f495f6311dff0d908bad0e084ac09a11e8e45f67a5d85d196cb04dc43d270b9e", + "h1:6c1adMvZpeIv2oqXT0hoTCUO8LSq0UxWGJnPey56VKg=", + "zh:1720258635c34406db44e3d08df9cc02e6897f804d6d558e1c73772324df7b30", + "zh:1a385e9b3d7cda4d76b242f78086f33600c566386fde97d625f3bd39e1dcb1ff", + "zh:26e01a0059c3d9954d0af22ccc05bb21a5b8af7f91a790311cf8ba13e10a5646", + "zh:2acdab4240714cc31407324773280eeeb8ec9ab420404a3f3b8c0f25d73a5e00", + "zh:4836143995c83c925b040c8bc7d3958fa6743c2179a098e783bf919e17db16ab", + "zh:4ca384ea0153ba101af3ca97276f59e76586f935c99b444bd360a4009756af2d", + "zh:54cc3398e8c336bd3f836954f87d3a7ae8fc4bced070baac66a244af656163d4", + "zh:a3e5d9eacc27047ea0c3c00753da3966516dfc982dee180a3a5f4a405689447e", + "zh:cc2052e93d0b52151a2374aa49e56de823ff11dce0570fa7c4bbbcf89467670f", + "zh:d8dc64ade395715dbb41753bda72b1bce6348cd2011f95b1cea1b2c675770c58", + "zh:da1fe36816881dac4acd7ab37291365c4b92584b8689c7c745c7a5b6800049c0", "zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c", - "zh:f750e6c18cca47bac08f7998998b4c9df570cabd66c52dd0faa0439670c4df31", - "zh:fbca2a8537b2ea350761131e71ac529888b7949625055b2461a377f8838d3d98", ] } diff --git a/infrastructure/base/main.tf b/infrastructure/base/main.tf index 816b53854..cf0a1956f 100644 --- a/infrastructure/base/main.tf +++ b/infrastructure/base/main.tf @@ -36,9 +36,7 @@ module "staging" { backend_min_scale = 0 frontend_max_scale = 1 backend_max_scale = 1 - redirect_domain = var.redirect_domain dns_zone_name = module.dns.dns_zone_name - redirect_dns_zone_name = module.redirect_dns.dns_zone_name subdomain = "staging" uptime_alert_email = var.uptime_alert_email from_email_address = var.from_email_address @@ -70,9 +68,7 @@ module "production" { frontend_min_scale = 1 backend_min_scale = 1 cors_origin = "https://${var.domain}" - redirect_domain = var.redirect_domain dns_zone_name = module.dns.dns_zone_name - redirect_dns_zone_name = module.redirect_dns.dns_zone_name uptime_alert_email = var.uptime_alert_email from_email_address = var.from_email_address instance_role = "production" @@ -91,12 +87,6 @@ module "dns" { name = "hecoinvest" } -module "redirect_dns" { - source = "./modules/dns" - domain = var.redirect_domain - name = "heco-redirect" -} - module "sendgrid_dns_entries" { source = "./modules/sendgrid_dns_entries" domain = var.domain diff --git a/infrastructure/base/modules/env/main.tf b/infrastructure/base/modules/env/main.tf index e421ad3fb..aa81301db 100644 --- a/infrastructure/base/modules/env/main.tf +++ b/infrastructure/base/modules/env/main.tf @@ -1,6 +1,5 @@ locals { domain = var.subdomain == "" ? var.domain : "${var.subdomain}.${var.domain}" - redirect_domain = var.subdomain == "" ? var.redirect_domain : "${var.subdomain}.${var.redirect_domain}" } module "network" { @@ -567,8 +566,6 @@ module "load_balancer" { frontend_cloud_run_name = module.frontend_cloudrun.name domain = var.domain dns_managed_zone_name = var.dns_zone_name - redirect_domain = var.redirect_domain - redirect_domain_dns_managed_zone_name = var.redirect_dns_zone_name subdomain = var.subdomain } diff --git a/infrastructure/base/modules/env/variables.tf b/infrastructure/base/modules/env/variables.tf index e5db785b0..c775e41a0 100644 --- a/infrastructure/base/modules/env/variables.tf +++ b/infrastructure/base/modules/env/variables.tf @@ -82,21 +82,11 @@ variable "dns_zone_name" { description = "Name for the GCP DNS Zone" } -variable "redirect_dns_zone_name" { - type = string - description = "Name for the GCP redirect DNS Zone" -} - variable "domain" { type = string description = "Base domain for the DNS zone" } -variable "redirect_domain" { - type = string - description = "Legacy domain to redirect" -} - variable "subdomain" { type = string default = "" diff --git a/infrastructure/base/modules/gcr/main.tf b/infrastructure/base/modules/gcr/main.tf index 7096274c7..509f3f54f 100644 --- a/infrastructure/base/modules/gcr/main.tf +++ b/infrastructure/base/modules/gcr/main.tf @@ -11,4 +11,6 @@ resource "google_artifact_registry_repository" "repository" { repository_id = var.name description = "Docker image repository for ${var.name}" format = "DOCKER" + + cleanup_policy_dry_run = true } diff --git a/infrastructure/base/modules/load-balancer/main.tf b/infrastructure/base/modules/load-balancer/main.tf index 818a09c2c..81e2ef6b0 100644 --- a/infrastructure/base/modules/load-balancer/main.tf +++ b/infrastructure/base/modules/load-balancer/main.tf @@ -7,7 +7,6 @@ resource "google_compute_global_address" "ip_address" { locals { domain = var.subdomain == "" ? var.domain : "${var.subdomain}.${var.domain}" - redirect_domain = var.subdomain == "" ? var.redirect_domain : "${var.subdomain}.${var.redirect_domain}" } # ------------------------------------------------------------------------------ @@ -33,7 +32,7 @@ resource "google_compute_managed_ssl_certificate" "load-balancer-certificate" { name = "${var.name}-lb-cert" managed { - domains = [local.domain, local.redirect_domain] + domains = [local.domain] } } @@ -82,20 +81,6 @@ resource "google_compute_url_map" "load-balancer-url-map" { service = google_compute_backend_service.backend_service.id } } - - host_rule { - hosts = [local.redirect_domain] - path_matcher = "redirect" - } - - path_matcher { - name = "redirect" - default_url_redirect { - strip_query = false - host_redirect = local.domain - https_redirect = true - } - } } resource "google_compute_region_network_endpoint_group" "cloudrun_backend_neg" { @@ -148,12 +133,3 @@ resource "google_dns_record_set" "frontend-dns-record-set" { rrdatas = [google_compute_global_address.ip_address.address] } -# DNS record -resource "google_dns_record_set" "redirect-dns-record-set" { - project = var.project - name = "${local.redirect_domain}." - type = "A" - ttl = 3600 - managed_zone = var.redirect_domain_dns_managed_zone_name - rrdatas = [google_compute_global_address.ip_address.address] -} diff --git a/infrastructure/base/modules/load-balancer/variables.tf b/infrastructure/base/modules/load-balancer/variables.tf index b84ce9a4d..788e39020 100644 --- a/infrastructure/base/modules/load-balancer/variables.tf +++ b/infrastructure/base/modules/load-balancer/variables.tf @@ -39,12 +39,3 @@ variable "subdomain" { description = "If set, it will be prepended to the domain to form a subdomain." } -variable "redirect_domain" { - type = string - description = "Legacy domain to redirect" -} - -variable "redirect_domain_dns_managed_zone_name" { - type = string - description = "Name of the DNS Zone" -} diff --git a/infrastructure/base/variables.tf b/infrastructure/base/variables.tf index 5b5e9fecd..2cf4ac13d 100644 --- a/infrastructure/base/variables.tf +++ b/infrastructure/base/variables.tf @@ -76,11 +76,6 @@ variable "uptime_alert_email" { description = "Email address to which uptime alerts should be sent" } -variable "redirect_domain" { - type = string - description = "Legacy domain to redirect" -} - variable "from_email_address" { type = string description = "Email address from which to send emails" diff --git a/infrastructure/base/vars/terraform.tfvars b/infrastructure/base/vars/terraform.tfvars index da63eb90b..03e2787ff 100644 --- a/infrastructure/base/vars/terraform.tfvars +++ b/infrastructure/base/vars/terraform.tfvars @@ -13,6 +13,5 @@ staging_project_name = "staging-heco" production_project_name = "heco" domain = "hecoinvest.org" -redirect_domain = "heco.vizzuality.com" google_analytics_key = "changeMe" uptime_alert_email = "tiago.garcia@vizzuality.com" diff --git a/infrastructure/base/versions.tf b/infrastructure/base/versions.tf index 8885c7641..60e890b8b 100644 --- a/infrastructure/base/versions.tf +++ b/infrastructure/base/versions.tf @@ -2,12 +2,12 @@ terraform { required_providers { google = { source = "hashicorp/google" - version = "~> 4.20" + version = "~> 5.7" } google-beta = { source = "hashicorp/google-beta" - version = "~> 4.20" + version = "~> 5.7" } random = { @@ -15,7 +15,7 @@ terraform { version = "~> 3.1.0" } } - required_version = "1.2.4" + required_version = "1.4.7" } provider "google" {