Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New vpc channel resource support #1273

Merged
merged 3 commits into from
Jul 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 115 additions & 0 deletions docs/resources/apig_vpc_channel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
---
subcategory: "API Gateway (APIG)"
---

# huaweicloud_apig_vpc_channel

Manages a VPC channel resource within HuaweiCloud.

## Example Usage

```hcl
variable "instance_id" {}
variable "channel_name" {}
variable "ecs_id1" {}
variable "ecs_id2" {}

resource "huaweicloud_apig_vpc_channel" "test" {
instance_id = var.instance_id
name = var.app_name
port = 8080
protocol = "HTTPS"
path = "/"
http_code = "201,202,203"

members {
id = var.ecs_id1
weight = 30
}

members {
id = var.ecs_id2
weight = 70
}
}
```

## Argument Reference

The following arguments are supported:

* `region` - (Optional, String, ForceNew) Specifies the region in which to create the VPC channel resource.
If omitted, the provider-level region will be used.
Changing this will create a new VPC channel resource.

* `instance_id` - (Required, String, ForceNew) Specifies an ID of the APIG dedicated instance to which the APIG
vpc channel belongs to.
Changing this will create a new VPC channel resource.

* `name` - (Required, String) Specifies the name of the VPC channel.
The channel name consists of 3 to 64 characters, starting with a letter.
Only letters, digits and underscores (_) are allowed.
Chinese characters must be in UTF-8 or Unicode format.

* `port` - (Optional, Int) Specifies the host port of the VPC channel.
The valid value is range from 1 to 65535.

* `member_type` - (Optional, String) Specifies the type of the backend service.
The valid types are *ECS* and *EIP*, default to *ECS*.

* `algorithm` - (Optional, String) Specifies the type of the backend service.
The valid types are *WRR*, *WLC*, *SH* and *URI hashing*, default to *WRR*.

* `protocol` - (Optional, String) Specifies the protocol for performing health checks on backend servers in the VPC
channel.
The valid values are *TCP*, *HTTP* and *HTTPS*, default to *TCP*.

* `path` - (Optional, String) Specifies the destination path for health checks.
Required if `protocol` is *HTTP* or *HTTPS*.

* `healthy_threshold` - (Optional, Int) Specifies the healthy threshold, which refers to the number of consecutive
successful checks required for a backend server to be considered healthy.
The valid value is range from 2 to 10, default to 2.

* `unhealthy_threshold` - (Optional, Int) Specifies the unhealthy threshold, which refers to the number of consecutive
failed checks required for a backend server to be considered unhealthy.
The valid value is range from 2 to 10, default to 5.

* `timeout` - (Optional, Int) Specifies the timeout for determining whether a health check fails, in second.
The value must be less than the value of time_interval.
The valid value is range from 2 to 30, default to 5.

* `interval` - (Optional, Int) Specifies the interval between consecutive checks, in second.
The valid value is range from 5 to 300, default to 10.

* `members` - (Optional, List) Specifies an array of one or more backend server IDs or IP addresses that bind the VPC
channel.
The object structure is documented below.

The `members` block supports:

* `id` - (Optional, String) Specifies the ECS ID for each backend servers.
Required if `member_type` is *ECS*.
This parameter and `ip_address` are alternative.

* `ip_address` - (Optional, String) Specifies the IP address each backend servers.
Required if `member_type` is *EIP*.

* `weight` - (Optional, Int) Specifies the backend server weight.
The valid values are range from 1 to 100, default to 1.

## Attributes Reference

In addition to all arguments above, the following attributes are exported:

* `id` - ID of the VPC channel.
* `create_time` - Time when the channel created, in UTC format.
* `status` - The status of VPC channel, supports *Normal* and *Abnormal*.

## Import

VPC Channels can be imported using their `name` and ID of the APIG dedicated instance to which the channel
belongs, separated by a slash, e.g.
```
$ terraform import huaweicloud_apig_vpc_channel.test <instance id>/<channel name>
```
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/hashicorp/errwrap v1.0.0
github.com/hashicorp/go-multierror v1.0.0
github.com/hashicorp/terraform-plugin-sdk v1.16.0
github.com/huaweicloud/golangsdk v0.0.0-20210706092920-c12079d6a740
github.com/huaweicloud/golangsdk v0.0.0-20210713095604-edcae43d4b99
github.com/jen20/awspolicyequivalence v1.1.0
github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa // indirect
github.com/stretchr/testify v1.4.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d h1:kJCB4vdITiW1eC1
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
github.com/huaweicloud/golangsdk v0.0.0-20210706092920-c12079d6a740 h1:RCAJI5jVLah5GJkr1lk9I0g6+PdTjUMCwzY5pUUd7fA=
github.com/huaweicloud/golangsdk v0.0.0-20210706092920-c12079d6a740/go.mod h1:fcOI5u+0f62JtJd7zkCch/Z57BNC6bhqb32TKuiF4r0=
github.com/huaweicloud/golangsdk v0.0.0-20210713095604-edcae43d4b99 h1:Pzb0u4b6pzF27EN1d72hwWXSFW4lj+MeATwt14DZSfg=
github.com/huaweicloud/golangsdk v0.0.0-20210713095604-edcae43d4b99/go.mod h1:fcOI5u+0f62JtJd7zkCch/Z57BNC6bhqb32TKuiF4r0=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/imdario/mergo v0.3.9 h1:UauaLniWCFHWd+Jp9oCEkTBj8VO/9DKg3PV3VCNMDIg=
github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
Expand Down
1 change: 1 addition & 0 deletions huaweicloud/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ func Provider() terraform.ResourceProvider {
"huaweicloud_api_gateway_group": ResourceAPIGatewayGroup(),
"huaweicloud_apig_instance": apig.ResourceApigInstanceV2(),
"huaweicloud_apig_application": apig.ResourceApigApplicationV2(),
"huaweicloud_apig_vpc_channel": apig.ResourceApigVpcChannelV2(),
"huaweicloud_as_configuration": ResourceASConfiguration(),
"huaweicloud_as_group": ResourceASGroup(),
"huaweicloud_as_lifecycle_hook": ResourceASLifecycleHook(),
Expand Down
Loading