-
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.
feat: Add module message template (#4)
- Loading branch information
1 parent
f421e34
commit 0987982
Showing
4 changed files
with
106 additions
and
1 deletion.
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 |
---|---|---|
@@ -1 +1,40 @@ | ||
# Module name | ||
# Huawei Cloud LTS Message Template | ||
<!-- BEGIN_TF_DOCS --> | ||
## Requirements | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | ~> 1.4 | | ||
| <a name="requirement_huaweicloud"></a> [huaweicloud](#requirement\_huaweicloud) | ~>1.47 | | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="provider_huaweicloud"></a> [huaweicloud](#provider\_huaweicloud) | ~>1.47 | | ||
|
||
## Modules | ||
|
||
No modules. | ||
|
||
## Resources | ||
|
||
| Name | Type | | ||
|------|------| | ||
| [huaweicloud_lts_notification_template.test](https://registry.terraform.io/providers/huaweicloud/huaweicloud/latest/docs/resources/lts_notification_template) | resource | | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| <a name="input_content"></a> [content](#input\_content) | Content of template | `string` | n/a | yes | | ||
| <a name="input_locale"></a> [locale](#input\_locale) | Language | `string` | `"en-us"` | no | | ||
| <a name="input_name"></a> [name](#input\_name) | Specifies the name of the template | `string` | n/a | yes | | ||
| <a name="input_name_postfix"></a> [name\_postfix](#input\_name\_postfix) | Name Postfix | `string` | `null` | no | | ||
| <a name="input_sub_type"></a> [sub\_type](#input\_sub\_type) | Type of the template | `string` | `"email"` | no | | ||
| <a name="input_template_source"></a> [template\_source](#input\_template\_source) | The source of the notification template, currently, this parameter is mandatory to LTS | `string` | `"LTS"` | no | | ||
|
||
## Outputs | ||
|
||
No outputs. | ||
<!-- END_TF_DOCS --> |
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,14 @@ | ||
locals { | ||
name = var.name_postfix == null ? var.name : format("%s-%s", var.name, var.name_postfix) | ||
} | ||
|
||
resource "huaweicloud_lts_notification_template" "test" { | ||
name = var.name | ||
source = var.template_source | ||
locale = var.locale | ||
|
||
templates { | ||
sub_type = var.sub_type | ||
content = var.content | ||
} | ||
} |
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,45 @@ | ||
variable "name" { | ||
description = "Specifies the name of the template" | ||
type = string | ||
} | ||
|
||
variable "name_postfix" { | ||
description = "Name Postfix" | ||
type = string | ||
default = null | ||
} | ||
|
||
variable "content" { | ||
description = "Content of template" | ||
type = string | ||
} | ||
|
||
variable "locale" { | ||
description = "Language" | ||
type = string | ||
default = "en-us" | ||
validation { | ||
condition = contains(["zh-cn", "en-us"], var.locale) | ||
error_message = "Locale is not one of: zh-cn, en-us" | ||
} | ||
} | ||
|
||
variable "sub_type" { | ||
description = "Type of the template" | ||
type = string | ||
default = "email" | ||
validation { | ||
condition = contains(["sms", "dingding", "wechat", "webhook", "email"], var.sub_type) | ||
error_message = "Type of template is not one of: sms, dingding, wechat, webhook, email" | ||
} | ||
} | ||
|
||
variable "template_source" { | ||
description = "The source of the notification template, currently, this parameter is mandatory to LTS" | ||
type = string | ||
default = "LTS" | ||
validation { | ||
condition = var.template_source == "LTS" | ||
error_message = "Template source is not LTS" | ||
} | ||
} |
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,3 +1,10 @@ | ||
terraform { | ||
required_version = "~> 1.4" | ||
|
||
required_providers { | ||
huaweicloud = { | ||
source = "huaweicloud/huaweicloud" | ||
version = "~>1.47" | ||
} | ||
} | ||
} |