From e15573da45192ce0ab106b5a5c4e13827fb2abb7 Mon Sep 17 00:00:00 2001 From: Jared Holgate Date: Sun, 8 Oct 2023 16:56:03 +0100 Subject: [PATCH 1/3] Add self hosted VCS support --- bootstrap/azuredevops/variables.tf | 4 ++-- bootstrap/github/variables.tf | 2 +- bootstrap/modules/azure_devops/locals.tf | 2 +- bootstrap/modules/github/locals.tf | 2 +- docs/wiki/[User-Guide]-Quick-Start-Phase-2.md | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bootstrap/azuredevops/variables.tf b/bootstrap/azuredevops/variables.tf index f6288756..eeec738b 100644 --- a/bootstrap/azuredevops/variables.tf +++ b/bootstrap/azuredevops/variables.tf @@ -11,7 +11,7 @@ variable "version_control_system_access_token" { } variable "version_control_system_organization" { - description = "The organization for the version control system to use for the deployment|3" + description = "The organization for the version control system to use for the deployment (supply a fqdn e.g. https://vcs.company.com/my-org to use a self-hosted Azure DevOps Server)|3" type = string } @@ -39,7 +39,7 @@ variable "postfix_number" { } variable "azure_devops_use_organisation_legacy_url" { - description = "Use the legacy Azure DevOps URL (.visualstudio.com) instead of the new URL (dev.azure.com/)|8|bool" + description = "Use the legacy Azure DevOps URL (.visualstudio.com) instead of the new URL (dev.azure.com/). This is ignored if an fqdn is supplied for version_control_system_organization|8|bool" type = bool default = false } diff --git a/bootstrap/github/variables.tf b/bootstrap/github/variables.tf index 3a40aa9a..871a4283 100644 --- a/bootstrap/github/variables.tf +++ b/bootstrap/github/variables.tf @@ -11,7 +11,7 @@ variable "version_control_system_access_token" { } variable "version_control_system_organization" { - description = "The organization for the version control system to use for the deployment|3" + description = "The organization for the version control system to use for the deployment (supply a fqdn e.g. https://vcs.company.com/my-org to use a self-hosted GitHub Enterprise Server)|3" type = string } diff --git a/bootstrap/modules/azure_devops/locals.tf b/bootstrap/modules/azure_devops/locals.tf index ef150c3f..86e40b05 100644 --- a/bootstrap/modules/azure_devops/locals.tf +++ b/bootstrap/modules/azure_devops/locals.tf @@ -1,5 +1,5 @@ locals { - organization_url = var.use_legacy_organization_url ? "https://${var.organization_name}.visualstudio.com" : "https://dev.azure.com/${var.organization_name}" + organization_url = startswith(lower(var.organization_name), "https://") || startswith(lower(var.organization_name), "http://") ? var.organization_name : (var.use_legacy_organization_url ? "https://${var.organization_name}.visualstudio.com" : "https://dev.azure.com/${var.organization_name}") } locals { diff --git a/bootstrap/modules/github/locals.tf b/bootstrap/modules/github/locals.tf index db7ff1be..f9d1bfda 100644 --- a/bootstrap/modules/github/locals.tf +++ b/bootstrap/modules/github/locals.tf @@ -1,3 +1,3 @@ locals { - organization_url = "https://github.com/${var.organization_name}" + organization_url = startswith(lower(var.organization_name), "https://") || startswith(lower(var.organization_name), "http://") ? var.organization_name : "https://github.com/${var.organization_name}" } diff --git a/docs/wiki/[User-Guide]-Quick-Start-Phase-2.md b/docs/wiki/[User-Guide]-Quick-Start-Phase-2.md index a29d90c0..e12cfbae 100644 --- a/docs/wiki/[User-Guide]-Quick-Start-Phase-2.md +++ b/docs/wiki/[User-Guide]-Quick-Start-Phase-2.md @@ -19,12 +19,12 @@ The inputs differ depending on the VCS you have chosen: 1. Fill out the following inputs: 1. `starter_module`: This is the choice of [Starter Modules][wiki_starter_modules], which is the baseline configuration you want for your Azure landing zone. This also determine the second set of input you'll be prompted for here. 1. `version_control_system_access_token`: Enter the Azure DevOps PAT you generated in a previous step. - 1. `version_control_system_organization`: Enter the name of your Azure DevOps organization. + 1. `version_control_system_organization`: Enter the name of your Azure DevOps organization. If you are using a self-hosted Azure DevOps Server, supply the fqdn, e.g. `https://vcs.company.com/my-org`. 1. `azure_location`: Enter the Azure region where you would like to deploy the storage account and identity for your continuous delivery pipeline. This field expects the `name` of the region, such as `uksouth`. You can find a full list of names by running `az account list-locations -o table`. 1. `service_name`: This is used to build up the names of your Azure and Azure DevOps resources, for example `rg--mgmt-uksouth-001`. We recommend using `alz` for this. 1. `environment_name`: This is used to build up the names of your Azure and Azure DevOps resources, for example `rg-alz--uksouth-001`. We recommend using `mgmt` for this. 1. `postfix_number`: This is used to build up the names of your Azure and Azure DevOps resources, for example `rg-alz-mgmt-uksouth-`. We recommend using `1` for this. - 1. `azure_devops_use_organisation_legacy_url`: If you have not migrated to the modern url (still using `https://.visualstudio.com`) for your Azure DevOps organisation, then set this to `true`. + 1. `azure_devops_use_organisation_legacy_url`: If you have not migrated to the modern url (still using `https://.visualstudio.com`) for your Azure DevOps organisation, then set this to `true`. This is ignored if you supply an fqdn to `version_control_system_organization`. 1. `azure_devops_create_project`: If you have an existing project you want to use rather than creating a new one, select `true`. We recommend creating a new project to ensure it is isolated by a strong security boundary. 1. `azure_devops_project_name`: Enter the name of the Azure DevOps project to create or the name of an existing poroject if you set `azure_devops_create_project` to `false`. 1. `azure_devops_authentication_scheme`: Enter the authentication scheme that your pipeline will use to authenticate to Azure. `WorkloadIdentityFederation` uses OpenId Connect and is the recommended approach. `ManagedServiceIdentity` requires the deployment of self-hosted agents are part of the bootstrap setup. @@ -44,7 +44,7 @@ The inputs differ depending on the VCS you have chosen: 1. Fill out the following inputs: 1. `starter_module`: This is the choice of [Starter Module][wiki_starter_modules], which is the baseline configuration you want for your Azure landing zone. This also determine the second set of input you'll be prompted for here. 1. `version_control_system_access_token`: Enter the GitHub PAT you generated in a previous step. - 1. `version_control_system_organization`: Enter the name of your GitHub organization. + 1. `version_control_system_organization`: Enter the name of your GitHub organization. If you are using a self-hosted GitHub Enterprise Server, supply the fqdn, e.g. `https://vcs.company.com/my-org`. 1. `azure_location`: Enter the Azure region where you would like to deploy the storage account and identity for your continuous delivery pipeline. This field expects the `name` of the region, such as `uksouth`. You can find a full list of names by running `az account list-locations -o table`. 1. `service_name`: This is used to build up the names of your Azure and GitHub resources, for example `rg--mgmt-uksouth-001`. We recommend using `alz` for this. 1. `environment_name`: This is used to build up the names of your Azure and GitHub resources, for example `rg-alz--uksouth-001`. We recommend using `mgmt` for this. From cc3c454a232eccd1b5d207d2bb2bf8a07a759fe6 Mon Sep 17 00:00:00 2001 From: Jared Holgate Date: Sun, 8 Oct 2023 16:58:30 +0100 Subject: [PATCH 2/3] Fix formatting --- bootstrap/modules/github/locals.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap/modules/github/locals.tf b/bootstrap/modules/github/locals.tf index f9d1bfda..a42f3eca 100644 --- a/bootstrap/modules/github/locals.tf +++ b/bootstrap/modules/github/locals.tf @@ -1,3 +1,3 @@ locals { - organization_url = startswith(lower(var.organization_name), "https://") || startswith(lower(var.organization_name), "http://") ? var.organization_name : "https://github.com/${var.organization_name}" + organization_url = startswith(lower(var.organization_name), "https://") || startswith(lower(var.organization_name), "http://") ? var.organization_name : "https://github.com/${var.organization_name}" } From 6a12f7e177f3fe73cd42a25a5b40e9071fbd41a5 Mon Sep 17 00:00:00 2001 From: Jared Holgate Date: Mon, 9 Oct 2023 08:29:17 +0100 Subject: [PATCH 3/3] Fix ordering after merge conflict --- bootstrap/azuredevops/variables.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap/azuredevops/variables.tf b/bootstrap/azuredevops/variables.tf index 31a9611f..9ae109cd 100644 --- a/bootstrap/azuredevops/variables.tf +++ b/bootstrap/azuredevops/variables.tf @@ -45,7 +45,7 @@ variable "postfix_number" { } variable "azure_devops_use_organisation_legacy_url" { - description = "Use the legacy Azure DevOps URL (.visualstudio.com) instead of the new URL (dev.azure.com/). This is ignored if an fqdn is supplied for version_control_system_organization|8|bool" + description = "Use the legacy Azure DevOps URL (.visualstudio.com) instead of the new URL (dev.azure.com/). This is ignored if an fqdn is supplied for version_control_system_organization|9|bool" type = bool default = false }