¯\_(ツ)_/¯

thunder@home:~$

This is my home blog, mostly to share some useful info or code snippets
< 1 min

Hey all,

Some time ago while using Terraform Cloud I faced issue when I was need to access AWS resources while I had SG with whitelisted access.

Main idea is:

  • get your IP
  • add that IP into SG

Here is workaround for Terraform:

data "http" "myip" {
  url = "http://ipv4.icanhazip.com"
}

And whenever you want to place your IP just use data.http.myip.body, example:

ingress {
  from_port = 5432
  to_port = 5432
  protocol = "tcp"
  cidr_blocks = ["${chomp(data.http.myip.body)}/32"]
}

Easy :)

You’ll get changes on every run!

Thank You For Reading