Skip to content

Commit

Permalink
feat: Add name postfix (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
Karina5005 authored Nov 7, 2023
1 parent 705ecd5 commit e8e2231
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ No modules.
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_emails"></a> [emails](#input\_emails) | Specifies the subscriptions emails | `list(string)` | `[]` | no |
| <a name="input_name_postfix"></a> [name\_postfix](#input\_name\_postfix) | Name Postfix | `string` | `null` | 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
Expand Down
4 changes: 4 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
locals {
name = var.name_postfix == null ? var.topic_name : format("%s-%s", var.topic_name, var.name_postfix)
}

resource "huaweicloud_smn_topic" "topic" {
name = var.topic_name
}
Expand Down
7 changes: 7 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ variable "topic_name" {
type = string
}


variable "name_postfix" {
description = "Name Postfix"
type = string
default = null
}

variable "emails" {
description = "Specifies the subscriptions emails"
type = list(string)
Expand Down

0 comments on commit e8e2231

Please sign in to comment.