Skip to content

Commit

Permalink
feat: Add Huawei Cloud SMN module (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
Karina5005 authored Nov 7, 2023
1 parent 2367cd7 commit bb09e53
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 1 deletion.
41 changes: 40 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,40 @@
# Module name
# Huawei Cloud SMN
<!-- 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_smn_subscription.emails](https://registry.terraform.io/providers/huaweicloud/huaweicloud/latest/docs/resources/smn_subscription) | resource |
| [huaweicloud_smn_topic.topic](https://registry.terraform.io/providers/huaweicloud/huaweicloud/latest/docs/resources/smn_topic) | resource |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_emails"></a> [emails](#input\_emails) | Specifies the subscriptions emails | `list(string)` | `[]` | no |
| <a name="input_topic_name"></a> [topic\_name](#input\_topic\_name) | Specifies the name of the topic to be created | `string` | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| <a name="output_topic_id"></a> [topic\_id](#output\_topic\_id) | The ID of a created topic |
| <a name="output_topic_name"></a> [topic\_name](#output\_topic\_name) | The ID of a created topic |
<!-- END_TF_DOCS -->
11 changes: 11 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
resource "huaweicloud_smn_topic" "topic" {
name = var.topic_name
}

resource "huaweicloud_smn_subscription" "emails" {
for_each = toset(var.emails)

topic_urn = huaweicloud_smn_topic.topic.id
endpoint = each.value
protocol = "email"
}
9 changes: 9 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
output "topic_id" {
description = "The ID of a created topic"
value = huaweicloud_smn_topic.topic.id
}

output "topic_name" {
description = "The ID of a created topic"
value = huaweicloud_smn_topic.topic.name
}
10 changes: 10 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
variable "topic_name" {
description = "Specifies the name of the topic to be created"
type = string
}

variable "emails" {
description = "Specifies the subscriptions emails"
type = list(string)
default = []
}
7 changes: 7 additions & 0 deletions versions.tf
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"
}
}
}

0 comments on commit bb09e53

Please sign in to comment.