Skip to content

Instantly share code, notes, and snippets.

@fonsecas72
Created November 2, 2020 15:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fonsecas72/77c3c88465b45171434c980f7e1c939e to your computer and use it in GitHub Desktop.
Save fonsecas72/77c3c88465b45171434c980f7e1c939e to your computer and use it in GitHub Desktop.
create terraform vars file based on AWS ip-ranges
#!/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