Skip to content

Commit 326cdac

Browse files
committed
Support checkly
1 parent 226bd9e commit 326cdac

File tree

3 files changed

+49
-1
lines changed

3 files changed

+49
-1
lines changed

examples/service-ip-ranges/main.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ locals {
1212
service = "ATLASSIAN"
1313
category = "jira"
1414
},
15+
{
16+
service = "CHECKLY"
17+
category = "all"
18+
},
1519
{
1620
service = "GITHUB"
1721
category = "all"

modules/service-ip-ranges/main.tf

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ locals {
77
"all" = setunion(values(local.atlassian_cidrs)...)
88
}, {})
99
)
10+
## Checkly
11+
"CHECKLY" = {
12+
"all" = setunion(
13+
local.checkly_ipv4_cidrs,
14+
local.checkly_ipv6_cidrs,
15+
)
16+
}
1017
## GitHub
1118
"GITHUB" = merge(
1219
local.github_cidrs,
@@ -66,6 +73,42 @@ locals {
6673
}
6774

6875

76+
###################################################
77+
# IP Ranges for Checkly
78+
###################################################
79+
80+
data "http" "checkly_ipv4" {
81+
count = var.service == "CHECKLY" ? 1 : 0
82+
83+
url = "https://api.checklyhq.com/v1/static-ips"
84+
}
85+
86+
data "http" "checkly_ipv6" {
87+
count = var.service == "CHECKLY" ? 1 : 0
88+
89+
url = "https://api.checklyhq.com/v1/static-ipv6s"
90+
}
91+
92+
locals {
93+
checkly_ipv4_data = (var.service == "CHECKLY"
94+
? jsondecode(trimspace(data.http.checkly_ipv4[0].response_body))
95+
: []
96+
)
97+
checkly_ipv6_data = (var.service == "CHECKLY"
98+
? jsondecode(trimspace(data.http.checkly_ipv6[0].response_body))
99+
: []
100+
)
101+
checkly_ipv4_cidrs = toset([
102+
for ip in local.checkly_ipv4_data :
103+
"${ip}/32"
104+
])
105+
checkly_ipv6_cidrs = toset([
106+
for ip in local.checkly_ipv6_data :
107+
ip
108+
])
109+
}
110+
111+
69112
###################################################
70113
# IP Ranges for GitHub.com
71114
###################################################

modules/service-ip-ranges/variables.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ variable "service" {
66
validation {
77
condition = contains([
88
"ATLASSIAN",
9+
"CHECKLY",
910
"GITHUB",
1011
"OKTA",
1112
"SCALR",
1213
"TERRAFORM_CLOUD",
1314
], var.service)
14-
error_message = "Valid values for `service` are `ATLASSIAN`, `GITHUB`, `OKTA`, `SCALR`, `TERRAFORM_CLOUD`."
15+
error_message = "Valid values for `service` are `ATLASSIAN`, `CHECKLY`, `GITHUB`, `OKTA`, `SCALR`, `TERRAFORM_CLOUD`."
1516
}
1617
}
1718

0 commit comments

Comments
 (0)