Last active
May 29, 2020 15:28
Revisions
-
karl-cardenas-coding revised this gist
Mar 7, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -11,7 +11,7 @@ data "http" "primary-server" { locals { # This returns the sync token from the endpoint, the return value is of the type string. syncToken = try(jsondecode(data.http.primary-server.body).syncToken, "NO TOKEN AVAILABLE" ) -
karl-cardenas-coding revised this gist
Mar 7, 2020 . 1 changed file with 15 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -11,24 +11,36 @@ data "http" "primary-server" { locals { # This returns the sync token from the endpoint, the return value is of the type string. syncToken = try(jsondecode(data.http.primary-server.body).syncTokenMadeUp, "NO TOKEN AVAILABLE" ) # This variable holds the all the unique regions returned by the endpoint. The return value is of the type list OR a string error value. regions = try(distinct([ for items in jsondecode(data.http.primary-server.body).prefixes: items.region ]), "NO LIST PROVIDED IN LOCALS REGION VARIABLE") # This variable holds the all the unique services returned by the endpoint. The return value is of the type list OR a string error value. services = try(distinct([ for items in jsondecode(data.http.primary-server.body).prefixes: items.service ]), "NO LIST PROVIDED IN LOCALS SERVICES VARIABLE") # This variable holds the all the IPs addresses for the S3 service returned by the endpoint. The return value is of the type list OR a string error value. s3_ips = try(distinct([ for items in jsondecode(data.http.primary-server.body).prefixes: items.ip_prefix if items.service == "S3" ]), "NO LIST PROVIDED IN LOCALS SERVICES VARIABLE") } output "response-json-syncToken" { value = local.syncToken } output "response-json-s3-ips" { value = local.s3_ips } output "response-json-regions" { -
karl-cardenas-coding created this gist
Mar 7, 2020 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,40 @@ # Try example data "http" "primary-server" { url = "https://ip-ranges.amazonaws.com/ip-ranges.json" # Optional request headers request_headers = { Accept = "application/json" } } locals { # This returns the sync token from the endpoint, the return value is of the type string. syncToken = try(jsondecode(data.http.primary-server.body).syncToken, "NO TOKEN AVAILABLE" ) # This variable holds the all the unique regions returned by the endpoint. The return value is of the type list OR a string error value. regions = try(distinct([ for items in jsondecode(data.http.primary-server.body).prefixes: items.region ]), "NO LIST PROVIDED IN LOCALS REGION VARIABLE") # This variable holds the all the unique services returned by the endpoint. The return value is of the type list OR a string error value. services = try(distinct([ for items in jsondecode(data.http.primary-server.body).prefixes: items.service ]), "NO LIST PROVIDED IN LOCALS SERVICES VARIABLE") } output "response-json-regions" { value = local.regions } output "response-json-services" { value = local.services }