Skip to content

Commit ef40f1b

Browse files
binary-koanclaudelinear-code[bot]
authored
U-9020 Support the status page published toggle (#221)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: Jono Mingard <1077405+binary-koan@users.noreply.github.com> Co-authored-by: linear-code[bot] <222613912+linear-code[bot]@users.noreply.github.com>
1 parent f1fa014 commit ef40f1b

5 files changed

Lines changed: 16 additions & 1 deletion

File tree

docs/resources/betteruptime_status_page.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ resource "betteruptime_status_page" "this" {
3131
timezone = "Eastern Time (US & Canada)"
3232
subdomain = "tf-status-${random_id.status_page_subdomain.hex}"
3333
subscribable = true
34+
published = true
3435
3536
# Set to your own domain, e.g. "status.example.com" - setting it back to "" removes the custom domain again
3637
custom_domain = ""
@@ -140,6 +141,7 @@ resource "betteruptime_status_page" "secure" {
140141
- `navigation_links` (Block List) Adjust the navigation links on your status page. Only applicable when design: v2. Only first 4 links considered. (see [below for nested schema](#nestedblock--navigation_links))
141142
- `password` (String, Sensitive) Set a password of your status page (we won't store it as plaintext, promise). Required when password_enabled: true. We will set password_enabled: false automatically when you send us an empty password.
142143
- `password_enabled` (Boolean) Do you want to enable password protection on your status page?
144+
- `published` (Boolean) Is your status page currently accessible?
143145
- `require_sso` (Boolean) Require SSO sign-in to access your status page. Requires SSO to be configured for your organization and is mutually exclusive with password protection.
144146
- `status_page_group_id` (Number) Set this attribute if you want to add this status page to a status page group.
145147
- `subscribable` (Boolean) Do you want to allow users to subscribe to your status page changes?

examples/resources/betteruptime_status_page/resource.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ resource "betteruptime_status_page" "this" {
1616
timezone = "Eastern Time (US & Canada)"
1717
subdomain = "tf-status-${random_id.status_page_subdomain.hex}"
1818
subscribable = true
19+
published = true
1920

2021
# Set to your own domain, e.g. "status.example.com" - setting it back to "" removes the custom domain again
2122
custom_domain = ""

examples/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ terraform {
33
required_providers {
44
betteruptime = {
55
source = "BetterStackHQ/better-uptime"
6-
version = ">= 0.21.6"
6+
version = ">= 0.21.9"
77
}
88
}
99
}

internal/provider/resource_status_page.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ var statusPageSchema = map[string]*schema.Schema{
9393
Computed: true,
9494
Description: "Do you want to allow users to subscribe to your status page changes?",
9595
},
96+
"published": {
97+
Type: schema.TypeBool,
98+
Optional: true,
99+
Computed: true,
100+
Description: "Is your status page currently accessible?",
101+
},
96102
"hide_from_search_engines": {
97103
Type: schema.TypeBool,
98104
Optional: true,
@@ -292,6 +298,7 @@ type statusPage struct {
292298
CustomDomain *string `json:"custom_domain,omitempty"`
293299
MinIncidentLength *int `json:"min_incident_length,omitempty"`
294300
Subscribable *bool `json:"subscribable,omitempty"`
301+
Published *bool `json:"published,omitempty"`
295302
HideFromSearchEngines *bool `json:"hide_from_search_engines,omitempty"`
296303
CustomCSS *string `json:"custom_css,omitempty"`
297304
CustomJavaScript *string `json:"custom_javascript,omitempty"`
@@ -343,6 +350,7 @@ func statusPageRef(in *statusPage) []struct {
343350
{k: "custom_domain", v: &in.CustomDomain},
344351
{k: "min_incident_length", v: &in.MinIncidentLength},
345352
{k: "subscribable", v: &in.Subscribable},
353+
{k: "published", v: &in.Published},
346354
{k: "hide_from_search_engines", v: &in.HideFromSearchEngines},
347355
{k: "custom_css", v: &in.CustomCSS},
348356
{k: "custom_javascript", v: &in.CustomJavaScript},

internal/provider/resource_status_page_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ func TestResourceStatusPage(t *testing.T) {
3737
subdomain = "%s"
3838
password = "secret123"
3939
automatic_reports = true
40+
published = true
4041
4142
navigation_links {
4243
text = "Example"
@@ -54,6 +55,7 @@ func TestResourceStatusPage(t *testing.T) {
5455
resource.TestCheckResourceAttr("betteruptime_status_page.this", "timezone", "UTC"),
5556
resource.TestCheckResourceAttr("betteruptime_status_page.this", "password", "secret123"),
5657
resource.TestCheckResourceAttr("betteruptime_status_page.this", "automatic_reports", "true"),
58+
resource.TestCheckResourceAttr("betteruptime_status_page.this", "published", "true"),
5759
resource.TestCheckResourceAttr("betteruptime_status_page.this", "navigation_links.0.text", "Example"),
5860
resource.TestCheckResourceAttr("betteruptime_status_page.this", "navigation_links.0.href", "https://example.com"),
5961
resource.TestCheckResourceAttr("betteruptime_status_page.this", "navigation_links.1.text", "Status"),
@@ -73,6 +75,7 @@ func TestResourceStatusPage(t *testing.T) {
7375
timezone = "America/Los_Angeles"
7476
subdomain = "%s"
7577
password = "secret1234"
78+
published = false
7679
navigation_links {
7780
text = "Example2"
7881
href = "https://example.com/test"
@@ -88,6 +91,7 @@ func TestResourceStatusPage(t *testing.T) {
8891
resource.TestCheckResourceAttr("betteruptime_status_page.this", "subdomain", subdomain),
8992
resource.TestCheckResourceAttr("betteruptime_status_page.this", "timezone", "America/Los_Angeles"),
9093
resource.TestCheckResourceAttr("betteruptime_status_page.this", "password", "secret1234"),
94+
resource.TestCheckResourceAttr("betteruptime_status_page.this", "published", "false"),
9195
resource.TestCheckResourceAttr("betteruptime_status_page.this", "navigation_links.0.text", "Example2"),
9296
resource.TestCheckResourceAttr("betteruptime_status_page.this", "navigation_links.0.href", "https://example.com/test"),
9397
resource.TestCheckResourceAttr("betteruptime_status_page.this", "navigation_links.1.text", "Status"),

0 commit comments

Comments
 (0)