templates/packer: Set region in vector config

Vector 0.21 needs region set otherwise the healthcheck will
fail.
This commit is contained in:
Sanne Raymaekers 2022-04-19 10:20:16 +02:00 committed by Ondřej Budai
parent d38d4ab2c9
commit 1ded72b4dc

View file

@ -4,6 +4,8 @@ source /tmp/cloud_init_vars
echo "Writing vector config."
REGION=$(curl -Ls http://169.254.169.254/latest/dynamic/instance-identity/document | jq -r .region)
sudo mkdir -p /etc/vector
sudo tee /etc/vector/vector.toml > /dev/null << EOF
[sources.journald]
@ -13,6 +15,7 @@ exclude_units = ["vector.service"]
[sinks.out]
type = "aws_cloudwatch_logs"
inputs = [ "journald" ]
region = "${REGION}"
endpoint = "${CLOUDWATCH_LOGS_ENDPOINT_URL}"
group_name = "${CLOUDWATCH_LOG_GROUP}"
stream_name = "worker_syslog_{{ host }}"