forked from calidae/terraform-bitbucket-ip-addresses
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adapt former Atlassian provider to Google Cloud
- Loading branch information
Showing
6 changed files
with
23 additions
and
64 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.terraform* |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,19 @@ | ||
# Get the JSON list of IP Addresses from Bitbucket. | ||
data "http" "bitbucket_ips" { | ||
url = "https://ip-ranges.atlassian.com/" | ||
data "http" "this" { | ||
url = var.url | ||
|
||
request_headers = { | ||
"Accept" = "application/json" | ||
} | ||
} | ||
|
||
locals { | ||
ip_range = tolist(jsondecode(data.http.bitbucket_ips.response_body).items[*].cidr) | ||
_prefixes = tolist(jsondecode(data.http.this.response_body).prefixes) | ||
ipv4_range = compact([ | ||
for cidr in local.ip_range : | ||
replace(cidr, "/.*[:].*/", "") | ||
for p in local._prefixes : | ||
contains(keys(p), "ipv4Prefix") ? p.ipv4Prefix : null | ||
]) | ||
ipv6_range = compact([ | ||
for cidr in local.ip_range : | ||
replace(cidr, "/.*[.].*/", "") | ||
for p in local._prefixes : | ||
contains(keys(p), "ipv6Prefix") ? p.ipv6Prefix : null | ||
]) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,9 @@ | ||
output "ip_range" { | ||
description = "A list of IPv4 and IPv6 Addresses for outbound connections from Bitbucket's services." | ||
value = local.ip_range | ||
} | ||
|
||
output "ipv4_range" { | ||
description = "A list of IPv4 Addresses for outbound connections from Bitbucket's services." | ||
description = "A list of IPv4 Addresses for outbound connections from Google Cloud." | ||
value = local.ipv4_range | ||
} | ||
|
||
output "ipv6_range" { | ||
description = "A list of IPv6 Addresses for outbound connections from Bitbucket's services." | ||
value = local.ipv6_range | ||
} | ||
|
||
output "ipv4_ip_addresses" { | ||
description = "Alias to ipv4_range" | ||
value = local.ipv4_range | ||
} | ||
|
||
output "ipv6_ip_addresses" { | ||
description = "Alias to ipv6_range" | ||
description = "A list of IPv6 Addresses for outbound connections from Google Cloud." | ||
value = local.ipv6_range | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
variable "url" { | ||
default = "https://www.gstatic.com/ipranges/cloud.json" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
terraform { | ||
required_version = ">= 0.12" | ||
required_version = ">= 1" | ||
required_providers { | ||
http = { | ||
source = "hashicorp/http" | ||
version = ">= 2.2.0, < 4.0.0" | ||
version = ">= 3" | ||
} | ||
} | ||
} |