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

Use just the FQDN for ARM metadata host endpoints with Terraform #241

Closed
glennmusa opened this issue Jun 3, 2021 · 0 comments · Fixed by #243
Closed

Use just the FQDN for ARM metadata host endpoints with Terraform #241

glennmusa opened this issue Jun 3, 2021 · 0 comments · Fixed by #243
Assignees

Comments

@glennmusa
Copy link
Contributor

glennmusa commented Jun 3, 2021

Benefit/Result/Outcome
Users deploying into an air-gapped cloud can run quickstart CLI deployments. Today they cannot.

Description
Today, when using the quickstart CLI deployment, we pass the output of az cloud show --query endpoints.resourceManager as the metadata host URI for initializing, applying, and destroying Terraform backends.

However, in some clouds, the HTTP URI is not permitted for this value and only the FQDN is allowed.

in an air-gapped cloud, this is not valid:

# not valid
terraform init \
  -backend-config "metadata_host=https://management.azure.com/"

but, in an air-gapped cloud, this is valid:

# valid
terraform init \
  -backend-config "metadata_host=management.azure.com"

the smallest way to do this is to check if mlz_metadatahost is the key name of the value we're printing to file and then to strip the HTTP-ness of the string then (and until the need arises to selectively trim strings of HTTP when building the .mlzconfig I don't think we need to build anything more complex than that):

append_cloud_value() {
local mlz_key_name=$1
local cloud_key_name=$2
local file=$3
local cloud_key_value
cloud_key_value=$(az cloud show --query "${cloud_key_name}" --output tsv)
if [[ $cloud_key_value ]]; then
printf "%s=%s\n" "${mlz_key_name}" "${cloud_key_value}" >> "${file}"
fi
}

Acceptance Criteria

  • When generating an MLZ config file, strip the mlz_metadatahost value of URI identifiers leaving just the FQDN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant