-
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.
- Loading branch information
1 parent
3416046
commit ea5a4ff
Showing
5 changed files
with
103 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,42 @@ | ||
# Module name | ||
# Huaweicloud ELB IP Group | ||
<!-- 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_elb_ipgroup.main](https://registry.terraform.io/providers/huaweicloud/huaweicloud/latest/docs/resources/elb_ipgroup) | resource | | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| <a name="input_description"></a> [description](#input\_description) | Specifies the description of an elb ip group | `string` | `null` | no | | ||
| <a name="input_ip_list"></a> [ip\_list](#input\_ip\_list) | Specifies the list of allowed IP address or CIDR block | `list(string)` | `[]` | no | | ||
| <a name="input_name"></a> [name](#input\_name) | Specifies the elb ip group name | `string` | n/a | yes | | ||
| <a name="input_name_postfix"></a> [name\_postfix](#input\_name\_postfix) | Specifies the elb ip group name postfix | `string` | `null` | no | | ||
| <a name="input_region"></a> [region](#input\_region) | Specifies the region in which to create the resource, if omitted, the provider-level region will be used | `string` | `null` | no | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| <a name="output_id"></a> [id](#output\_id) | The uuid of the ip group | | ||
| <a name="output_name"></a> [name](#output\_name) | The name of the ip group | | ||
<!-- 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,16 @@ | ||
locals { | ||
name = var.name_postfix == null ? format("%s-ip-group", var.name) : format("%s-elb-%s", var.name, var.name_postfix) | ||
} | ||
|
||
resource "huaweicloud_elb_ipgroup" "main" { | ||
name = local.name | ||
description = var.description | ||
region = var.region | ||
|
||
dynamic "ip_list" { | ||
for_each = toset(var.ip_list) | ||
content { | ||
ip = ip_list.key | ||
} | ||
} | ||
} |
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,9 @@ | ||
output "id" { | ||
description = "The uuid of the ip group" | ||
value = huaweicloud_elb_ipgroup.main.id | ||
} | ||
|
||
output "name" { | ||
description = "The name of the ip group" | ||
value = huaweicloud_elb_ipgroup.main.name | ||
} |
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,29 @@ | ||
variable "name" { | ||
description = "Specifies the elb ip group name" | ||
type = string | ||
nullable = false | ||
} | ||
|
||
variable "name_postfix" { | ||
description = "Specifies the elb ip group name postfix" | ||
type = string | ||
default = null | ||
} | ||
|
||
variable "description" { | ||
description = "Specifies the description of an elb ip group" | ||
type = string | ||
default = null | ||
} | ||
|
||
variable "region" { | ||
description = "Specifies the region in which to create the resource, if omitted, the provider-level region will be used" | ||
type = string | ||
default = null | ||
} | ||
|
||
variable "ip_list" { | ||
description = "Specifies the list of allowed IP address or CIDR block" | ||
type = list(string) | ||
default = [] | ||
} |
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" | ||
} | ||
} | ||
} |