Skip to content

[feature] set Vault cluster name - #3

Open
sbeliakou wants to merge 1 commit into
hashicorp:masterfrom
sbeliakou:feature/vault-cluster-name
Open

[feature] set Vault cluster name#3
sbeliakou wants to merge 1 commit into
hashicorp:masterfrom
sbeliakou:feature/vault-cluster-name

Conversation

@sbeliakou

Copy link
Copy Markdown
Contributor

Taking Vault cluster name from Azure VM cluster name

$ AZURE_INSTANCE_METADATA_URL="http://169.254.169.254/metadata/instance?api-version=2017-08-01"
$ curl --silent --show-error --header Metadata:true --location "$AZURE_INSTANCE_METADATA_URL"

{
  "compute": {
    "location": "northeurope",
    "name": "vault-cluster_1",
    "offer": "",
    "osType": "Linux",
...
}

$ curl --silent --show-error --header Metadata:true --location "$AZURE_INSTANCE_METADATA_URL" | jq -r '.compute.name' | sed 's/_[^_]*//'
vault-cluster

@mcalhoun mcalhoun added the wip label Nov 8, 2017
@mcalhoun

mcalhoun commented Nov 8, 2017

Copy link
Copy Markdown
Contributor

Won't the output of .compute.name be different for each node? We'd actually want the name of the cluster to be consistent across all nodes in the cluster.

@sbeliakou

Copy link
Copy Markdown
Contributor Author

The names of nodes (taken from metadata) are "vault-cluster_$nodeIndex". This quick fix just wipes out the tail.

This is currently the only one option how "$vault-cluster-name" can come into vault config file.

Off course, we can pass this variable to custom_data directly (/opt/vault/bin/run-vault), get from metadata (as advised above) or extract from tags.

@hashicorp-cla

Copy link
Copy Markdown

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes

Have you signed the CLA already but the status is still pending? Recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants