From 17ee60f039a6bcc0051a3b97d14d72df4924457e Mon Sep 17 00:00:00 2001 From: Annie Hedgpeth Date: Thu, 16 Nov 2023 16:52:26 -0700 Subject: [PATCH 1/4] add registry variable --- main.tf | 8 +++++--- tests/standalone-mounted-disk/locals.tf | 6 ++++-- tests/standalone-mounted-disk/main.tf | 3 ++- tests/standalone-mounted-disk/outputs.tf | 2 +- tests/standalone-mounted-disk/variables.tf | 8 ++++---- variables.tf | 18 ++++++++++++------ 6 files changed, 28 insertions(+), 17 deletions(-) diff --git a/main.tf b/main.tf index e26c86bf..9969a55a 100644 --- a/main.tf +++ b/main.tf @@ -137,7 +137,7 @@ module "database" { # Azure user data / cloud init used to install and configure TFE on instance(s) using Flexible Deployment Options # --------------------------------------------------------------------------------------------------------------- module "tfe_init_fdo" { - source = "git::https://github.com/hashicorp/terraform-random-tfe-utility//modules/tfe_init?ref=main" + source = "git::https://github.com/hashicorp/terraform-random-tfe-utility//modules/tfe_init?ref=ah/TF-10844-registry" count = var.is_replicated_deployment ? 0 : 1 cloud = "azurerm" @@ -164,8 +164,10 @@ module "tfe_init_fdo" { var.network_cidr ] - registry_username = var.registry_username - registry_password = var.registry_password + registry = var.registry + registry_password = var.registry == "images.releases.hashicorp.com" ? var.hc_license : var.registry_password + registry_username = var.registry_username + docker_compose_yaml = module.docker_compose_config[0].docker_compose_yaml } diff --git a/tests/standalone-mounted-disk/locals.tf b/tests/standalone-mounted-disk/locals.tf index de23af0e..e71473ac 100644 --- a/tests/standalone-mounted-disk/locals.tf +++ b/tests/standalone-mounted-disk/locals.tf @@ -3,9 +3,8 @@ locals { common_tags = { - Terraform = "False" Environment = "${local.friendly_name_prefix}-test-standalone-mounted-disk" - Description = "Standalone, Mounted Disk scenario deployed from CircleCI" + Description = "Standalone, Mounted Disk scenario" Repository = "hashicorp/terraform-azurerm-terraform-enterprise" Team = "Terraform Enterprise on Prem" OkToDelete = "True" @@ -40,6 +39,9 @@ locals { var.vm_image_sku != null && var.vm_image_version != null ) ? var.vm_image_version : null + utility_module_test = var.license_file == null friendly_name_prefix = random_string.friendly_name.id + # registry = "quay.io" + registry = "images.releases.hashicorp.com" } diff --git a/tests/standalone-mounted-disk/main.tf b/tests/standalone-mounted-disk/main.tf index 17cf7c73..bca7e17f 100644 --- a/tests/standalone-mounted-disk/main.tf +++ b/tests/standalone-mounted-disk/main.tf @@ -69,7 +69,8 @@ module "standalone_mounted_disk" { http_port = 8080 https_port = 8443 license_reporting_opt_out = true + registry = local.registry registry_password = var.registry_password registry_username = var.registry_username - tfe_image = "quay.io/hashicorp/terraform-enterprise:${var.tfe_image_tag}" + tfe_image = "${local.registry}/hashicorp/terraform-enterprise:${var.tfe_image_tag}" } diff --git a/tests/standalone-mounted-disk/outputs.tf b/tests/standalone-mounted-disk/outputs.tf index 7374b979..b1ea69c2 100644 --- a/tests/standalone-mounted-disk/outputs.tf +++ b/tests/standalone-mounted-disk/outputs.tf @@ -7,7 +7,7 @@ output "replicated_console_password" { } output "replicated_console_url" { - value = "${module.standalone_mounted_disk.tfe_application_url}:8800" + value = module.standalone_mounted_disk.replicated_console_url description = "Terraform Enterprise Console URL" } diff --git a/tests/standalone-mounted-disk/variables.tf b/tests/standalone-mounted-disk/variables.tf index f9321cba..f64ceab2 100644 --- a/tests/standalone-mounted-disk/variables.tf +++ b/tests/standalone-mounted-disk/variables.tf @@ -53,16 +53,16 @@ variable "license_file" { description = "The local path to the Terraform Enterprise license to be provided by CI." } -variable "registry_username" { +variable "registry_password" { default = null type = string - description = "(Not needed if is_replicated_deployment is true) The username for the docker registry from which to source the terraform_enterprise container images." + description = "(Not needed if is_replicated_deployment is true) The password for the docker registry from which to source the terraform_enterprise container images." } -variable "registry_password" { +variable "registry_username" { default = null type = string - description = "(Not needed if is_replicated_deployment is true) The password for the docker registry from which to source the terraform_enterprise container images." + description = "(Not needed if is_replicated_deployment is true) The username for the docker registry from which to source the terraform_enterprise container images." } variable "resource_group_name_dns" { diff --git a/variables.tf b/variables.tf index 18c7f09d..36cc79ee 100644 --- a/variables.tf +++ b/variables.tf @@ -36,9 +36,9 @@ variable "tfe_subdomain" { } variable "tfe_image" { - default = "quay.io/hashicorp/terraform-enterprise:latest" + default = "images.releases.hashicorp.com/hashicorp/terraform-enterprise:v202311-1" type = string - description = "(Not needed if is_replicated_deployment is true) The registry path, image name, and image version (e.g. \"quay.io/hashicorp/terraform-enterprise:1234567\")" + description = "(Not needed if is_replicated_deployment is true) The registry path, image name, and image version" } # DNS @@ -841,16 +841,22 @@ variable "hairpin_addressing" { description = "In some cloud environments, HTTP clients running on instances behind a loadbalancer cannot send requests to the public hostname of that load balancer. Use this setting to configure TFE services to redirect requests for the installation's FQDN to the instance's internal IP address. Defaults to false." } -variable "registry_username" { - default = null +variable "registry" { + default = "images.releases.hashicorp.com" type = string - description = "(Not needed if is_replicated_deployment is true) The username for the docker registry from which to source the terraform_enterprise container images." + description = "(Not needed if is_replicated_deployment is true) The docker registry from which to source the terraform_enterprise container images." } variable "registry_password" { default = null type = string - description = "(Not needed if is_replicated_deployment is true) The password for the docker registry from which to source the terraform_enterprise container images." + description = "(Not needed if is_replicated_deployment is true or if registry is 'images.releases.hashicorp.com') The password for the docker registry from which to source the terraform_enterprise container images." +} + +variable "registry_username" { + default = "terraform" + type = string + description = "(Not needed if is_replicated_deployment is true) The username for the docker registry from which to source the terraform_enterprise container images." } variable "run_pipeline_image" { From 523d7423fa61078629236775b1a7ec876031954c Mon Sep 17 00:00:00 2001 From: Annie Hedgpeth Date: Thu, 16 Nov 2023 17:07:47 -0700 Subject: [PATCH 2/4] add var.registry to tests --- tests/private-active-active/locals.tf | 8 ++++---- tests/private-active-active/main.tf | 3 ++- tests/private-active-active/variables.tf | 8 ++++---- tests/private-tcp-active-active/locals.tf | 8 ++++---- tests/private-tcp-active-active/main.tf | 3 ++- tests/private-tcp-active-active/variables.tf | 8 ++++---- tests/public-active-active/locals.tf | 4 ++-- tests/public-active-active/main.tf | 3 ++- tests/public-active-active/variables.tf | 8 ++++---- tests/standalone-external/locals.tf | 8 ++++---- tests/standalone-external/main.tf | 3 ++- tests/standalone-external/outputs.tf | 2 +- tests/standalone-external/variables.tf | 8 ++++---- tests/standalone-mounted-disk/locals.tf | 7 +++---- tests/standalone-mounted-disk/outputs.tf | 2 +- 15 files changed, 43 insertions(+), 40 deletions(-) diff --git a/tests/private-active-active/locals.tf b/tests/private-active-active/locals.tf index 1e42bed8..3fd0dd2a 100644 --- a/tests/private-active-active/locals.tf +++ b/tests/private-active-active/locals.tf @@ -3,17 +3,17 @@ locals { common_tags = { - Terraform = "cloud" Environment = "${local.friendly_name_prefix}-test-private-active-active" Description = "Private Active/Active" Repository = "hashicorp/terraform-azurerm-terraform-enterprise" - Team = "Terraform Enterprise on Prem" + Team = "Terraform Enterprise" OkToDelete = "True" } friendly_name_prefix = random_string.friendly_name.id - resource_group_name = module.private_active_active.resource_group_name + network_proxy_subnet_cidr = "10.0.80.0/20" proxy_user = "proxyuser" proxy_port = "3128" - network_proxy_subnet_cidr = "10.0.80.0/20" + registry = "quay.io" + resource_group_name = module.private_active_active.resource_group_name } diff --git a/tests/private-active-active/main.tf b/tests/private-active-active/main.tf index 238184f6..12fad690 100644 --- a/tests/private-active-active/main.tf +++ b/tests/private-active-active/main.tf @@ -86,7 +86,8 @@ module "private_active_active" { http_port = 8080 https_port = 8443 license_reporting_opt_out = true + registry = local.registry registry_password = var.registry_password registry_username = var.registry_username - tfe_image = "quay.io/hashicorp/terraform-enterprise:${var.tfe_image_tag}" + tfe_image = "${local.registry}/hashicorp/terraform-enterprise:${var.tfe_image_tag}" } diff --git a/tests/private-active-active/variables.tf b/tests/private-active-active/variables.tf index 26f40de1..c654bf8f 100644 --- a/tests/private-active-active/variables.tf +++ b/tests/private-active-active/variables.tf @@ -55,16 +55,16 @@ variable "proxy_public_ssh_key_secret_name" { description = "The name of the public SSH key secret for the proxy." } -variable "registry_username" { +variable "registry_password" { default = null type = string - description = "(Not needed if is_replicated_deployment is true) The username for the docker registry from which to source the terraform_enterprise container images." + description = "(Not needed if is_replicated_deployment is true) The password for the docker registry from which to source the terraform_enterprise container images." } -variable "registry_password" { +variable "registry_username" { default = null type = string - description = "(Not needed if is_replicated_deployment is true) The password for the docker registry from which to source the terraform_enterprise container images." + description = "(Not needed if is_replicated_deployment is true) The username for the docker registry from which to source the terraform_enterprise container images." } variable "resource_group_name_dns" { diff --git a/tests/private-tcp-active-active/locals.tf b/tests/private-tcp-active-active/locals.tf index 6e0c36bd..1fac9c2f 100644 --- a/tests/private-tcp-active-active/locals.tf +++ b/tests/private-tcp-active-active/locals.tf @@ -3,17 +3,17 @@ locals { common_tags = { - Terraform = "cloud" Environment = "${local.friendly_name_prefix}-test-private-tcp-active-active" Description = "Private TCP Active/Active" Repository = "hashicorp/terraform-azurerm-terraform-enterprise" - Team = "Terraform Enterprise on Prem" + Team = "Terraform Enterprise" OkToDelete = "True" } friendly_name_prefix = random_string.friendly_name.id - resource_group_name = module.private_tcp_active_active.resource_group_name + network_proxy_subnet_cidr = "10.0.80.0/20" proxy_user = "proxyuser" proxy_port = "3128" - network_proxy_subnet_cidr = "10.0.80.0/20" + registry = "quay.io" + resource_group_name = module.private_tcp_active_active.resource_group_name } diff --git a/tests/private-tcp-active-active/main.tf b/tests/private-tcp-active-active/main.tf index 3e2d9ad5..472d654a 100644 --- a/tests/private-tcp-active-active/main.tf +++ b/tests/private-tcp-active-active/main.tf @@ -87,7 +87,8 @@ module "private_tcp_active_active" { http_port = 8080 https_port = 8443 license_reporting_opt_out = true + registry = local.registry registry_password = var.registry_password registry_username = var.registry_username - tfe_image = "quay.io/hashicorp/terraform-enterprise:${var.tfe_image_tag}" + tfe_image = "${local.registry}/hashicorp/terraform-enterprise:${var.tfe_image_tag}" } diff --git a/tests/private-tcp-active-active/variables.tf b/tests/private-tcp-active-active/variables.tf index e1bad9f7..fd39de27 100644 --- a/tests/private-tcp-active-active/variables.tf +++ b/tests/private-tcp-active-active/variables.tf @@ -60,16 +60,16 @@ variable "proxy_public_ssh_key_secret_name" { description = "The name of the public SSH key secret for the proxy." } -variable "registry_username" { +variable "registry_password" { default = null type = string - description = "(Not needed if is_replicated_deployment is true) The username for the docker registry from which to source the terraform_enterprise container images." + description = "(Not needed if is_replicated_deployment is true) The password for the docker registry from which to source the terraform_enterprise container images." } -variable "registry_password" { +variable "registry_username" { default = null type = string - description = "(Not needed if is_replicated_deployment is true) The password for the docker registry from which to source the terraform_enterprise container images." + description = "(Not needed if is_replicated_deployment is true) The username for the docker registry from which to source the terraform_enterprise container images." } variable "resource_group_name_dns" { diff --git a/tests/public-active-active/locals.tf b/tests/public-active-active/locals.tf index 85774e6e..adf37d27 100644 --- a/tests/public-active-active/locals.tf +++ b/tests/public-active-active/locals.tf @@ -3,13 +3,13 @@ locals { common_tags = { - Terraform = "cloud" Environment = "${local.friendly_name_prefix}-test-public-active-active" Description = "Public Active/Active" Repository = "hashicorp/terraform-azurerm-terraform-enterprise" - Team = "Terraform Enterprise on Prem" + Team = "Terraform Enterprise" OkToDelete = "True" } friendly_name_prefix = random_string.friendly_name.id + registry = "quay.io" } diff --git a/tests/public-active-active/main.tf b/tests/public-active-active/main.tf index 65c8320f..edf82c1e 100644 --- a/tests/public-active-active/main.tf +++ b/tests/public-active-active/main.tf @@ -45,8 +45,9 @@ module "public_active_active" { http_port = 8080 https_port = 8443 license_reporting_opt_out = true + registry = local.registry registry_password = var.registry_password registry_username = var.registry_username - tfe_image = "quay.io/hashicorp/terraform-enterprise:${var.tfe_image_tag}" + tfe_image = "${local.registry}/hashicorp/terraform-enterprise:${var.tfe_image_tag}" } diff --git a/tests/public-active-active/variables.tf b/tests/public-active-active/variables.tf index f02eba2e..10b53366 100644 --- a/tests/public-active-active/variables.tf +++ b/tests/public-active-active/variables.tf @@ -45,16 +45,16 @@ variable "key_vault_id" { description = "The identity of the Key Vault which contains secrets and certificates." } -variable "registry_username" { +variable "registry_password" { default = null type = string - description = "(Not needed if is_replicated_deployment is true) The username for the docker registry from which to source the terraform_enterprise container images." + description = "(Not needed if is_replicated_deployment is true) The password for the docker registry from which to source the terraform_enterprise container images." } -variable "registry_password" { +variable "registry_username" { default = null type = string - description = "(Not needed if is_replicated_deployment is true) The password for the docker registry from which to source the terraform_enterprise container images." + description = "(Not needed if is_replicated_deployment is true) The username for the docker registry from which to source the terraform_enterprise container images." } variable "resource_group_name_dns" { diff --git a/tests/standalone-external/locals.tf b/tests/standalone-external/locals.tf index f67977c5..7a92e3ad 100644 --- a/tests/standalone-external/locals.tf +++ b/tests/standalone-external/locals.tf @@ -3,14 +3,14 @@ locals { common_tags = { - Terraform = "False" Environment = "${local.friendly_name_prefix}-test-standalone-external" - Description = "Standalone, External Services scenario deployed from CircleCI" + Description = "Standalone, External Services scenario" Repository = "hashicorp/terraform-azurerm-terraform-enterprise" - Team = "Terraform Enterprise on Prem" + Team = "Terraform Enterprise" OkToDelete = "True" } - utility_module_test = var.license_file == null friendly_name_prefix = random_string.friendly_name.id + registry = "quay.io" + utility_module_test = var.license_file == null } diff --git a/tests/standalone-external/main.tf b/tests/standalone-external/main.tf index 0beb5a6e..d49aa8fa 100644 --- a/tests/standalone-external/main.tf +++ b/tests/standalone-external/main.tf @@ -59,7 +59,8 @@ module "standalone_external" { http_port = 8080 https_port = 8443 license_reporting_opt_out = true + registry = local.registry registry_password = var.registry_password registry_username = var.registry_username - tfe_image = "quay.io/hashicorp/terraform-enterprise:${var.tfe_image_tag}" + tfe_image = "${local.registry}/hashicorp/terraform-enterprise:${var.tfe_image_tag}" } diff --git a/tests/standalone-external/outputs.tf b/tests/standalone-external/outputs.tf index c43b242a..cfafa819 100644 --- a/tests/standalone-external/outputs.tf +++ b/tests/standalone-external/outputs.tf @@ -7,7 +7,7 @@ output "replicated_console_password" { } output "replicated_console_url" { - value = "${module.standalone_external.tfe_application_url}:8800" + value = module.standalone_mounted_disk.tfe_console_url description = "Terraform Enterprise Console URL" } diff --git a/tests/standalone-external/variables.tf b/tests/standalone-external/variables.tf index 6b10eff8..1328bb8a 100644 --- a/tests/standalone-external/variables.tf +++ b/tests/standalone-external/variables.tf @@ -48,16 +48,16 @@ variable "license_file" { description = "The local path to the Terraform Enterprise license to be provided by CI." } -variable "registry_username" { +variable "registry_password" { default = null type = string - description = "(Not needed if is_replicated_deployment is true) The username for the docker registry from which to source the terraform_enterprise container images." + description = "(Not needed if is_replicated_deployment is true) The password for the docker registry from which to source the terraform_enterprise container images." } -variable "registry_password" { +variable "registry_username" { default = null type = string - description = "(Not needed if is_replicated_deployment is true) The password for the docker registry from which to source the terraform_enterprise container images." + description = "(Not needed if is_replicated_deployment is true) The username for the docker registry from which to source the terraform_enterprise container images." } variable "resource_group_name_dns" { diff --git a/tests/standalone-mounted-disk/locals.tf b/tests/standalone-mounted-disk/locals.tf index e71473ac..d6e7db6f 100644 --- a/tests/standalone-mounted-disk/locals.tf +++ b/tests/standalone-mounted-disk/locals.tf @@ -6,7 +6,7 @@ locals { Environment = "${local.friendly_name_prefix}-test-standalone-mounted-disk" Description = "Standalone, Mounted Disk scenario" Repository = "hashicorp/terraform-azurerm-terraform-enterprise" - Team = "Terraform Enterprise on Prem" + Team = "Terraform Enterprise" OkToDelete = "True" } vm_image_id = ( @@ -40,8 +40,7 @@ locals { var.vm_image_version != null ) ? var.vm_image_version : null - utility_module_test = var.license_file == null friendly_name_prefix = random_string.friendly_name.id - # registry = "quay.io" - registry = "images.releases.hashicorp.com" + registry = "quay.io" + utility_module_test = var.license_file == null } diff --git a/tests/standalone-mounted-disk/outputs.tf b/tests/standalone-mounted-disk/outputs.tf index b1ea69c2..359a15fe 100644 --- a/tests/standalone-mounted-disk/outputs.tf +++ b/tests/standalone-mounted-disk/outputs.tf @@ -7,7 +7,7 @@ output "replicated_console_password" { } output "replicated_console_url" { - value = module.standalone_mounted_disk.replicated_console_url + value = module.standalone_mounted_disk.tfe_console_url description = "Terraform Enterprise Console URL" } From 033325dbaf9ac1d52d082b3a39823be804a3ea7b Mon Sep 17 00:00:00 2001 From: Annie Hedgpeth Date: Thu, 16 Nov 2023 17:22:48 -0700 Subject: [PATCH 3/4] copy pasta --- tests/standalone-external/outputs.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/standalone-external/outputs.tf b/tests/standalone-external/outputs.tf index cfafa819..e31df0a6 100644 --- a/tests/standalone-external/outputs.tf +++ b/tests/standalone-external/outputs.tf @@ -7,7 +7,7 @@ output "replicated_console_password" { } output "replicated_console_url" { - value = module.standalone_mounted_disk.tfe_console_url + value = module.standalone_external.tfe_console_url description = "Terraform Enterprise Console URL" } From c4a072f5b65a3ef5b62ed227eb6e20a11ece810f Mon Sep 17 00:00:00 2001 From: Annie Hedgpeth Date: Fri, 17 Nov 2023 14:07:54 -0700 Subject: [PATCH 4/4] revert ref to main --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 9969a55a..6870e0d7 100644 --- a/main.tf +++ b/main.tf @@ -137,7 +137,7 @@ module "database" { # Azure user data / cloud init used to install and configure TFE on instance(s) using Flexible Deployment Options # --------------------------------------------------------------------------------------------------------------- module "tfe_init_fdo" { - source = "git::https://github.com/hashicorp/terraform-random-tfe-utility//modules/tfe_init?ref=ah/TF-10844-registry" + source = "git::https://github.com/hashicorp/terraform-random-tfe-utility//modules/tfe_init?ref=main" count = var.is_replicated_deployment ? 0 : 1 cloud = "azurerm"