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

remove URI components from metadata host service endpoint when generating .mlzconfig #243

Merged
merged 3 commits into from
Jun 4, 2021

Conversation

glennmusa
Copy link
Contributor

Description

Today, users in air-gapped clouds have issues initializing terraform backends when using the full ARM Metadata Host Service Endpoint URI (e.g. "https://management.azure.com/") and instead require just the host name (e.g. "management.azure.com")

This change, when using the deploy.sh quickstart, removes the URI components from the result of az cloud show --query endpoints.resourceManager when the .mlzconfig file is generated so that just the hostname value is passed as a metadata_host argument during terraform backend initialization. See #241 for more information.

Before, a .mlzconfig generated from deploy.sh used to generate a key value pair like this:

mlz_metadatahost=https://management.azure.com/

Now, it should generate a value like this:

mlz_metadatahost=management.azure.com

...and that plays nicer across clouds and azurerm providers.

You can test this manually with the generate_config_file.sh script:

my_tenant_id=$(az account show --query tenantId --output tsv)
my_sub_id=$(az account show --query id --output tsv)
src/scripts/config/generate_config_file.sh -f mytest.mlzconfig -e public -z mytestenvname -l eastus -s $my_sub_id -t $my_tenant_id

Issue reference

The issue this PR will close: #241

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles or validates correctly
  • BASH scripts have been validated using shellcheck
  • All tests pass (manual and automated)
  • The documentation is updated to cover any new or changed features
  • Markdown files have been linted using the recommended linter. (See .vscode/extensions.json.)
  • Relevant issues are linked to this PR

@glennmusa glennmusa added the do-not-merge This pull request is in process and should not be merged to main. label Jun 3, 2021
@glennmusa
Copy link
Contributor Author

glennmusa commented Jun 3, 2021

Awaiting on confirmation of expected metadata host values before merging.

@Phydeauxman
Copy link
Contributor

Looks great Glenn, thanks for the quick turn on this...and thanks for providing the quick test. I ran the test and got the expected outcome.

@glennmusa glennmusa changed the title remove URI components from metadata host service endpoint during terraform backend initialization remove URI components from metadata host service endpoint when generation .mlzconfig Jun 4, 2021
Copy link
Contributor

@Phydeauxman Phydeauxman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great Glenn. Took me a little bit to follow your logic here but only because I have never used some of the techniques you are using.

@glennmusa glennmusa changed the title remove URI components from metadata host service endpoint when generation .mlzconfig remove URI components from metadata host service endpoint when generating .mlzconfig Jun 4, 2021
@glennmusa glennmusa removed the do-not-merge This pull request is in process and should not be merged to main. label Jun 4, 2021
@glennmusa glennmusa merged commit e74b5ac into main Jun 4, 2021
@glennmusa glennmusa deleted the glennmusa/stripurifrommetadatahost branch June 4, 2021 11:59
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 this pull request may close these issues.

Use just the FQDN for ARM metadata host endpoints with Terraform
2 participants