-
-
Save fonsecas72/77c3c88465b45171434c980f7e1c939e to your computer and use it in GitHub Desktop.
create terraform vars file based on AWS ip-ranges
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | |
echo "cloudfront_ips = <<-EOF" > $DIR/cloudfront_ips.auto.tfvars && curl -s https://ip-ranges.amazonaws.com/ip-ranges.json | jq -r '.prefixes[] | select(.service=="ROUTE53" or .service=="CLOUDFRONT") | .ip_prefix' >> $DIR/cloudfront_ips.auto.tfvars && echo EOF >> $DIR/cloudfront_ips.auto.tfvars |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment