Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

vault-examples-helper error #229

Open
doncorsean opened this issue Jan 10, 2021 · 4 comments
Open

vault-examples-helper error #229

doncorsean opened this issue Jan 10, 2021 · 4 comments

Comments

@doncorsean
Copy link

Getting this error in helper script /vault-examples-helper/vault-examples-helper.sh

2021-01-10 17:57:17 [INFO] [vault-examples-helper.sh] Fetching public IP addresses for EC2 Instances in "us-east-1" with tag "Name"="vault-example"

Error parsing parameter '--filters': Expected: ',', received: '"' for input:
Name=tag:"Name",Values="vault-example"

If up correct the query so that it executes I receive the following

2021-01-10 18:41:48 [INFO] [vault-examples-helper.sh] Found all 3 public IP addresses!
2021-01-10 18:41:50 [INFO] [vault-examples-helper.sh] Waiting for 3 Vault servers to come up
2021-01-10 18:41:50 [INFO] [vault-examples-helper.sh] Checking health of Vault server via URL https://null:8200/v1/sys/health
curl: (6) Could not resolve host: null
2021-01-10 18:41:55 [INFO] [vault-examples-helper.sh] Got a 000 response from Vault server null with body:

@brikis98
Copy link
Collaborator

Can you show the full command you're running and the full log output?

@doncorsean
Copy link
Author

% ../vault-examples-helper/vault-examples-helper.sh
2021-01-14 07:10:17 [INFO] [vault-examples-helper.sh] Looking up public IP addresses for 3 Vault server EC2 Instances.
2021-01-14 07:10:22 [INFO] [vault-examples-helper.sh] Fetching public IP addresses for EC2 Instances in "us-east-1" with tag "Name"="vault-cluster"

Error parsing parameter '--filters': Expected: ',', received: '"' for input:
Name=tag:"Name",Values="vault-cluster"
^
2021-01-14 07:10:23 [WARN] [vault-examples-helper.sh] Found 0 of 3 public IP addresses. Will sleep for 10 seconds and try again.
2021-01-14 07:10:39 [INFO] [vault-examples-helper.sh] Fetching public IP addresses for EC2 Instances in "us-east-1" with tag "Name"="vault-cluster"

Error parsing parameter '--filters': Expected: ',', received: '"' for input:
Name=tag:"Name",Values="vault-cluster"
^
2021-01-14 07:10:39 [WARN] [vault-examples-helper.sh] Found 0 of 3 public IP addresses. Will sleep for 10 seconds and try again.

@doncorsean
Copy link
Author

It's the double quoting tripping things up. If I edit the script and hardcode the values it works fine.

  instances=$(aws ec2 describe-instances \
    --region "$aws_region" \
    --filter "Name=tag:$cluster_tag_key,Values=$cluster_tag_value" "Name=instance-state-name,Values=running")

vs.

  instances=$(aws ec2 describe-instances \
    --region "us-east-1" \
    --filter "Name=tag:Name,Values=vault-cluster" "Name=instance-state-name,Values=running")

@brikis98
Copy link
Collaborator

Ohhhh, are you using Terraform 0.14? If so, we have not yet updated this repo to work with it, and the issue you're hitting is that there was a backward incompatible change in the terraform output command introduced in Terraform 0.14. String values now come back with double quotes around them, which did not used to be the case before, and these unexpected double quotes, as you've seen, can cause a variety of issues.

We'll probably need to update the code to use the -json param with terraform output and carefully parse the results in the future, as the output API without -json is not stable for scripting, I guess.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants