· 6 years ago · Jun 20, 2019, 05:38 PM
1#!/bin/sh
2
3# Wait for stack to finish creating
4aws cloudformation wait stack-create-complete --stack-name iam-route53-user
5
6# Get AccessKey to variable
7ACCESS_KEY=$(aws cloudformation describe-stacks --stack-name iam-route53-user \
8 --query 'Stacks[0].Outputs[?OutputKey==`AccessKey`].OutputValue' \
9 --output text)
10
11# Get SecretKey to variable
12SECRET_KEY=$(aws cloudformation describe-stacks --stack-name iam-route53-user \
13 --query 'Stacks[0].Outputs[?OutputKey==`SecretKey`].OutputValue' \
14 --output text)
15
16# Save external-dns.yaml file with credentials
17tee <<EOF >./external-dns.yaml
18provider: aws
19aws:
20 secretKey: '$SECRET_KEY'
21 accessKey: '$ACCESS_KEY'
22rbac:
23 create: true
24EOF