Skip to content

Instantly share code, notes, and snippets.

@WhatsARanjit
Created May 20, 2022 17:29
Show Gist options
  • Save WhatsARanjit/050642e4d66ee4442fcd426a2b7d4cd1 to your computer and use it in GitHub Desktop.
Save WhatsARanjit/050642e4d66ee4442fcd426a2b7d4cd1 to your computer and use it in GitHub Desktop.
Datasource for TFC IP ranges
$ terraform apply -auto-approve
Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
Outputs:
api = [
"75.2.98.97/32",
"99.83.150.238/32",
]
notifications = [
"52.86.200.106/32",
"52.86.201.227/32",
"52.70.186.109/32",
"44.236.246.186/32",
"54.185.161.84/32",
"44.238.78.236/32",
]
sentinel = [
"52.86.200.106/32",
"52.86.201.227/32",
"52.70.186.109/32",
"44.236.246.186/32",
"54.185.161.84/32",
"44.238.78.236/32",
]
vcs = [
"52.86.200.106/32",
"52.86.201.227/32",
"52.70.186.109/32",
"44.236.246.186/32",
"54.185.161.84/32",
"44.238.78.236/32",
]
variable "tf_server" {
default = "app.terraform.io"
}
data "http" "ip_ranges" {
url = "https://${var.tf_server}/api/meta/ip-ranges"
}
output "api" {
value = jsondecode(data.http.ip_ranges.body)["api"]
}
output "notifications" {
value = jsondecode(data.http.ip_ranges.body)["notifications"]
}
output "sentinel" {
value = jsondecode(data.http.ip_ranges.body)["sentinel"]
}
output "vcs" {
value = jsondecode(data.http.ip_ranges.body)["vcs"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment