Skip to content

Commit

Permalink
Merge pull request #2146 from Michael9127/mike/update-gateway-blockpa…
Browse files Browse the repository at this point in the history
…ge-settings

Adds support for mailto blockpage fields
  • Loading branch information
jacobbednarz authored Jan 14, 2023
2 parents e9c3dc0 + 34f4986 commit 3410642
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/2146.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/cloudflare_teams_accounts: adds support for `mailto_address` and `mailto_subject` blockpage settings
```
2 changes: 2 additions & 0 deletions docs/resources/teams_account.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ Optional:
- `footer_text` (String) Block page footer text.
- `header_text` (String) Block page header text.
- `logo_path` (String) URL of block page logo.
- `mailto_address` (String) Admin email for users to contact.
- `mailto_subject` (String) Subject line for emails created from block page.
- `name` (String) Name of block page configuration.


Expand Down
4 changes: 4 additions & 0 deletions internal/provider/resource_cloudflare_teams_accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ func flattenBlockPageConfig(blockPage *cloudflare.TeamsBlockPage) []interface{}
"logo_path": blockPage.LogoPath,
"background_color": blockPage.BackgroundColor,
"name": blockPage.Name,
"mailto_address": blockPage.MailtoAddress,
"mailto_subject": blockPage.MailtoSubject,
}}
}

Expand Down Expand Up @@ -214,6 +216,8 @@ func inflateBlockPageConfig(blockPage interface{}) *cloudflare.TeamsBlockPage {
LogoPath: blockPageMap["logo_path"].(string),
BackgroundColor: blockPageMap["background_color"].(string),
Name: blockPageMap["name"].(string),
MailtoSubject: blockPageMap["mailto_subject"].(string),
MailtoAddress: blockPageMap["mailto_address"].(string),
}
}

Expand Down
4 changes: 4 additions & 0 deletions internal/provider/resource_cloudflare_teams_accounts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ func TestAccCloudflareTeamsAccountConfigurationBasic(t *testing.T) {
resource.TestCheckResourceAttr(name, "block_page.0.enabled", "true"),
resource.TestCheckResourceAttr(name, "block_page.0.footer_text", "hello"),
resource.TestCheckResourceAttr(name, "block_page.0.header_text", "hello"),
resource.TestCheckResourceAttr(name, "block_page.0.mailto_subject", "hello"),
resource.TestCheckResourceAttr(name, "block_page.0.mailto_address", "[email protected]"),
resource.TestCheckResourceAttr(name, "block_page.0.background_color", "#000000"),
resource.TestCheckResourceAttr(name, "block_page.0.logo_path", "https://example.com"),
resource.TestCheckResourceAttr(name, "logging.0.redact_pii", "true"),
Expand Down Expand Up @@ -66,6 +68,8 @@ resource "cloudflare_teams_account" "%[1]s" {
header_text = "hello"
logo_path = "https://example.com"
background_color = "#000000"
mailto_subject = "hello"
mailto_address = "[email protected]"
}
fips {
tls = true
Expand Down
10 changes: 10 additions & 0 deletions internal/provider/schema_cloudflare_teams_accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,16 @@ var blockPageSchema = map[string]*schema.Schema{
Optional: true,
Description: "Name of block page configuration.",
},
"mailto_address": {
Type: schema.TypeString,
Optional: true,
Description: "Admin email for users to contact.",
},
"mailto_subject": {
Type: schema.TypeString,
Optional: true,
Description: "Subject line for emails created from block page.",
},
}

var antivirusSchema = map[string]*schema.Schema{
Expand Down

0 comments on commit 3410642

Please sign in to comment.