Created
August 10, 2020 16:43
-
-
Save ksatirli/e43af33b42ad5fa61f5784a89f7a26d7 to your computer and use it in GitHub Desktop.
Terraform Cloud IP Ranges as Terraform Variables
This file contains 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
terraform { | |
required_providers { | |
http = "~> 1.2" | |
} | |
required_version = "~> 0.12.29" | |
} | |
data "http" "terraform_cloud_ip_ranges" { | |
url = "https://app.terraform.io/api/meta/ip-ranges" | |
request_headers = { | |
# Enabling the `If-Modified-Since` flag may result in an empty response | |
# If-Modified-Since = "Tue, 26 May 2020 15:10:05 GMT" | |
Accept = "application/json" | |
} | |
} | |
locals { | |
# assign JSONified output to a local variable | |
terraform_cloud_ip_ranges = jsondecode(data.http.terraform_cloud_ip_ranges.body) | |
} | |
output "terraform_cloud_api_ip_ranges" { | |
description = "Terraform Cloud API IP Ranges as JSON" | |
value = local.terraform_cloud_ip_ranges.api | |
} | |
output "terraform_cloud_notifications_ip_ranges" { | |
description = "Terraform Cloud Notifications IP Ranges as JSON" | |
value = local.terraform_cloud_ip_ranges.notifications | |
} | |
output "terraform_cloud_sentinel_ip_ranges" { | |
description = "Terraform Cloud Sentinel Runner IP Ranges as JSON" | |
value = local.terraform_cloud_ip_ranges.sentinel | |
} | |
output "terraform_cloud_ip_ranges" { | |
description = "Terraform Cloud VCS Integration IP Ranges as JSON" | |
value = local.terraform_cloud_ip_ranges.vcs | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment