Skip to content

Commit

Permalink
provider/alicloud: Add new resource ESS, including scalinggroup scali…
Browse files Browse the repository at this point in the history
…ngconfiguration scalingrule and schedule (#13731)

* add docs

* add new resource ess

* add examples

* update aliyun go

* merge master

* fix ci
  • Loading branch information
demonwy authored and stack72 committed Apr 18, 2017
1 parent 2faeebe commit f476b86
Show file tree
Hide file tree
Showing 20 changed files with 522 additions and 74 deletions.
27 changes: 13 additions & 14 deletions r/db_instance.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,22 @@ description: |-
Provides an RDS instance resource.
---

# alicloud_db_instance
# alicloud\_db\_instance

Provides an RDS instance resource. A DB instance is an isolated database
environment in the cloud. A DB instance can contain multiple user-created
databases.

## Example Usage

```hcl
```
resource "alicloud_db_instance" "default" {
commodity_code = "rds"
engine = "MySQL"
engine_version = "5.6"
db_instance_class = "rds.mysql.t1.small"
db_instance_storage = "10"
db_instance_net_type = "Intranet"
commodity_code = "rds"
engine = "MySQL"
engine_version = "5.6"
db_instance_class = "rds.mysql.t1.small"
db_instance_storage = "10"
db_instance_net_type = "Intranet"
}
```

Expand All @@ -32,13 +30,13 @@ resource "alicloud_db_instance" "default" {
The following arguments are supported:

* `engine` - (Required) Database type. Value options: MySQL, SQLServer, PostgreSQL, and PPAS.
* `engine_version` - (Required) Database version. Value options:
* `engine_version` - (Required) Database version. Value options:
- 5.5/5.6/5.7 for MySQL
- 2008r2/2012 for SQLServer
- 9.4 for PostgreSQL
- 9.3 for PPAS
* `db_instance_class` - (Required) Instance type. For details, see [Instance type table](https://intl.aliyun.com/help/doc-detail/26312.htm?spm=a3c0i.o26228en.a3.2.bRUHF3).
* `db_instance_storage` - (Required) User-defined storage space. Value range:
* `db_instance_storage` - (Required) User-defined storage space. Value range:
- [5, 2000] for MySQL/PostgreSQL/PPAS HA dual node edition;
- [20,1000] for MySQL 5.7 basic single node edition;
- [10, 2000] for SQL Server 2008R2;
Expand All @@ -65,7 +63,7 @@ The following arguments are supported:

The database mapping supports the following:

* `db_name` - (Required) Name of the database requiring a uniqueness check. It may consist of lower case letters, numbers and underlines, and must start with a letter and have no more than 64 characters.
* `db_name` - (Required) Name of the database requiring a uniqueness check. It may consist of lower case letters, numbers and underlines, and must start with a letter and have no more than 64 characters.
* `character_set_name` - (Required) Character set. The value range is limited to the following:
- MySQL type:
+ utf8
Expand All @@ -78,7 +76,7 @@ The database mapping supports the following:
+ SQL_Latin1_General_CP1_CI_AS
+ SQL_Latin1_General_CP1_CS_AS
+ Chinese_PRC_BIN
* `db_description` - (Optional) Database description, which cannot exceed 256 characters. NOTE: It cannot begin with https://.
* `db_description` - (Optional) Database description, which cannot exceed 256 characters. NOTE: It cannot begin with https://.


~> **NOTE:** We neither support modify any of database attribute, nor insert/remove item at the same time.
Expand All @@ -105,3 +103,4 @@ The following attributes are exported:
* `backup_retention_period` - Retention days of the backup.
* `security_ips` - Security ips of instance whitelist.
* `connections` - Views all the connection information of a specified instance.

12 changes: 7 additions & 5 deletions r/disk.html.markdown
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
---
layout: "alicloud"
page_title: "Alicloud: alicloud_disk"
sidebar_current: "docs-alicloud-resource-disk."
sidebar_current: "docs-alicloud-resource-disk"
description: |-
Provides a ECS Disk resource.
---

# alicloud_disk
# alicloud\_disk

Provides a ECS disk resource.

~> **NOTE:** One of `size` or `snapshot_id` is required when specifying an ECS disk. If all of them be specified, `size` must more than the size of snapshot which `snapshot_id` represents. Currently, `alicloud_disk` doesn't resize disk.

## Example Usage

```hcl
```
# Create a new ECS disk.
resource "alicloud_disk" "ecs_disk" {
# cn-beijing
availability_zone = "cn-beijing-b"
name = "New-disk"
description = "Hello ecs disk."
Expand All @@ -32,7 +34,7 @@ resource "alicloud_disk" "ecs_disk" {
The following arguments are supported:

* `availability_zone` - (Required, Forces new resource) The Zone to create the disk in.
* `name` - (Optional) Name of the ECS disk. This name can have a string of 2 to 128 characters, must contain only alphanumeric characters or hyphens, such as "-",".","\_", and must not begin or end with a hyphen, and must not begin with http:// or https://. Default value is null.
* `name` - (Optional) Name of the ECS disk. This name can have a string of 2 to 128 characters, must contain only alphanumeric characters or hyphens, such as "-",".","_", and must not begin or end with a hyphen, and must not begin with http:// or https://. Default value is null.
* `description` - (Optional) Description of the disk. This description can have a string of 2 to 256 characters, It cannot begin with http:// or https://. Default value is null.
* `category` - (Optional, Forces new resource) Category of the disk. Valid values are `cloud`, `cloud_efficiency` and `cloud_ssd`. Default is `cloud`.
* `size` - (Required) The size of the disk in GiBs, and its value depends on `Category`. `cloud` disk value range: 5GB ~ 2000GB and other category disk value range: 20 ~ 32768.
Expand All @@ -51,4 +53,4 @@ The following attributes are exported:
* `category` - The disk category.
* `size` - The disk size.
* `snapshot_id` - The disk snapshot ID.
* `tags` - The disk tags.
* `tags` - The disk tags.
8 changes: 5 additions & 3 deletions r/disk_attachment.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ description: |-
Provides a ECS Disk Attachment resource.
---

# alicloud_disk_attachment
# alicloud\_disk\_attachment

Provides an Alicloud ECS Disk Attachment as a resource, to attach and detach disks from ECS Instances.

## Example Usage

Basic usage

```hcl
```
# Create a new ECS disk-attachment and use it attach one disk to a new instance.
resource "alicloud_security_group" "ecs_sg" {
name = "terraform-test-group"
description = "New security group"
Expand Down Expand Up @@ -63,4 +65,4 @@ The following attributes are exported:

* `instance_id` - ID of the Instance.
* `disk_id` - ID of the Disk.
* `device_name` - The device name exposed to the instance.
* `device_name` - The device name exposed to the instance.
6 changes: 3 additions & 3 deletions r/eip.html.markdown
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
---
layout: "alicloud"
page_title: "Alicloud: alicloud_eip"
sidebar_current: "docs-alicloud-resource-eip."
sidebar_current: "docs-alicloud-resource-eip"
description: |-
Provides a ECS EIP resource.
---

# alicloud_eip
# alicloud\_eip

Provides a ECS EIP resource.

## Example Usage

```hcl
```
# Create a new EIP.
resource "alicloud_eip" "example" {
bandwidth = "10"
Expand Down
8 changes: 5 additions & 3 deletions r/eip_association.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: |-
Provides a ECS EIP Association resource.
---

# alicloud_eip_association
# alicloud\_eip\_association

Provides an Alicloud EIP Association resource, to associate and disassociate Elastic IPs from ECS Instances.

Expand All @@ -16,7 +16,9 @@ Provides an Alicloud EIP Association resource, to associate and disassociate Ela

## Example Usage

```hcl
```
# Create a new EIP association and use it to associate a EIP form a instance.
resource "alicloud_vpc" "vpc" {
cidr_block = "10.1.0.0/21"
}
Expand Down Expand Up @@ -71,4 +73,4 @@ The following arguments are supported:
The following attributes are exported:

* `allocation_id` - As above.
* `instance_id` - As above.
* `instance_id` - As above.
84 changes: 84 additions & 0 deletions r/ess_scaling_configuration.html.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
layout: "alicloud"
page_title: "Alicloud: alicloud_ess_scaling_configuration"
sidebar_current: "docs-alicloud-resource-ess-scaling-configuration"
description: |-
Provides a ESS scaling configuration resource.
---

# alicloud\_ess\_scaling\_configuration

Provides a ESS scaling configuration resource.

## Example Usage

```
resource "alicloud_security_group" "classic" {
# Other parameters...
}
resource "alicloud_ess_scaling_group" "scaling" {
min_size = 1
max_size = 2
removal_policies = ["OldestInstance", "NewestInstance"]
}
resource "alicloud_ess_scaling_configuration" "config" {
scaling_group_id = "${alicloud_ess_scaling_group.scaling.id}"
image_id = "ubuntu_140405_64_40G_cloudinit_20161115.vhd"
instance_type = "ecs.s2.large"
security_group_id = "${alicloud_security_group.classic.id}"
}
```

## Argument Reference

The following arguments are supported:

* `scaling_group_id` - (Required) ID of the scaling group of a scaling configuration.
* `image_id` - (Required) ID of an image file, indicating the image resource selected when an instance is enabled.
* `instance_type` - (Required) Resource type of an ECS instance.
* `io_optimized` - (Required) Valid values are `none`, `optimized`, If `optimized`, the launched ECS instance will be I/O optimized.
* `security_group_id` - (Required) ID of the security group to which a newly created instance belongs.
* `scaling_configuration_name` - (Optional) Name shown for the scheduled task. If this parameter value is not specified, the default value is ScalingConfigurationId.
* `internet_charge_type` - (Optional) Network billing type, Values: PayByBandwidth or PayByTraffic. If this parameter value is not specified, the default value is PayByBandwidth.
* `internet_max_bandwidth_in` - (Optional) Maximum incoming bandwidth from the public network, measured in Mbps (Mega bit per second). The value range is [1,200].
* `internet_max_bandwidth_out` - (Optional) Maximum outgoing bandwidth from the public network, measured in Mbps (Mega bit per second). The value range for PayByBandwidth is [1,100].
* `system_disk_category` - (Optional) Category of the system disk. The parameter value options are cloud and ephemeral.
* `data_disk` - (Optional) DataDisk mappings to attach to ecs instance. See [Block datadisk](#block-datadisk) below for details.
* `instance_ids` - (Optional) ID of the ECS instance to be attached to the scaling group after it is enabled. You can input up to 20 IDs.


## Block datadisk

The datadisk mapping supports the following:

* `size` - (Optional) Size of data disk, in GB. The value ranges from 5 to 2,000 for a cloud disk and from 5 to 1,024 for an ephemeral disk. A maximum of four values can be entered.
* `category` - (Optional) Category of data disk. The parameter value options are cloud and ephemeral.
* `snapshot_id` - (Optional) Snapshot used for creating the data disk. If this parameter is specified, the size parameter is neglected, and the size of the created disk is the size of the snapshot.
* `device` - (Optional) Attaching point of the data disk. If this parameter is empty, the ECS automatically assigns the attaching point when an ECS is created. The parameter value ranges from /dev/xvdb to /dev/xvdz. Restrictions on attaching ECS instances:
- The attached ECS instance and the scaling group must be in the same region.
- The attached ECS instance and the instance with active scaling configurations must be of the same type.
- The attached ECS instance must in the running state.
- The attached ECS instance has not been attached to other scaling groups.
- The attached ECS instance supports Subscription and Pay-As-You-Go payment methods.
- If the VswitchID is specified for a scaling group, you cannot attach Classic ECS instances or ECS instances on other VPCs to the scaling group.
- If the VswitchID is not specified for the scaling group, ECS instances of the VPC type cannot be attached to the scaling group
* `active` - (Optional) If active current scaling configuration in the scaling group.
* `enable` - (Optional) Enables the specified scaling group.
- After the scaling group is successfully enabled (the group is active), the ECS instances specified by the interface are attached to the group.
- If the current number of ECS instances in the scaling group is still smaller than MinSize after the ECS instances specified by the interface are attached, the Auto Scaling service automatically creates ECS instances in Pay-As-You-Go mode to make odds even. For example, a scaling group is created with MinSize = 5. Two existing ECS instances are specified by the InstanceId.N parameter when the scaling group is enabled. Three additional ECS instances are automatically created after the two ECS instances are attached by the Auto Scaling service to the scaling group.

## Attributes Reference

The following attributes are exported:

* `id` - The scaling configuration ID.
* `active` - Wether the current scaling configuration is actived.
* `image_id` - The ecs instance Image id.
* `instance_type` - The ecs instance type.
* `io_optimized` - The ecs instance whether I/O optimized.
* `security_group_id` - ID of the security group to which a newly created instance belongs.
* `scaling_configuration_name` - Name of scaling configuration.
* `internet_charge_type` - Internet charge type of ecs instance.
57 changes: 57 additions & 0 deletions r/ess_scaling_group.html.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
layout: "alicloud"
page_title: "Alicloud: alicloud_ess_scaling_group"
sidebar_current: "docs-alicloud-resource-ess-scaling-group"
description: |-
Provides a ESS scaling group resource.
---

# alicloud\_ess\_scaling\_group

Provides a ESS scaling group resource.

## Example Usage

```
resource "alicloud_ess_scaling_group" "scaling" {
min_size = 1
max_size = 2
removal_policies = ["OldestInstance", "NewestInstance"]
}
```

## Argument Reference

The following arguments are supported:

* `min_size` - (Required) Minimum number of ECS instances in the scaling group. Value range: [0, 100].
* `max_size` - (Required) Maximum number of ECS instances in the scaling group. Value range: [0, 100].
* `scaling_group_name` - (Optional) Name shown for the scaling group, which must contain 2-40 characters (English or Chinese). If this parameter is not specified, the default value is ScalingGroupId.
* `default_cooldown` - (Optional) Default cool-down time (in seconds) of the scaling group. Value range: [0, 86400]. The default value is 300s.
* `vswitch_id` - (Optional) The virtual switch ID which the ecs instance to be create in.
* `removal_policies` - (Optional) RemovalPolicy is used to select the ECS instances you want to remove from the scaling group when multiple candidates for removal exist. Optional values:
- OldestInstance: removes the first ECS instance attached to the scaling group.
- NewestInstance: removes the first ECS instance attached to the scaling group.
- OldestScalingConfiguration: removes the ECS instance with the oldest scaling configuration.
- Default values: OldestScalingConfiguration and OldestInstance. You can enter up to two removal policies.
* `db_instance_ids` - (Optional) If an RDS instance is specified in the scaling group, the scaling group automatically attaches the Intranet IP addresses of its ECS instances to the RDS access whitelist.
- The specified RDS instance must be in running status.
- The specified RDS instance’s whitelist must have room for more IP addresses.
* `loadbalancer_ids` - (Optional) If a Server Load Balancer instance is specified in the scaling group, the scaling group automatically attaches its ECS instances to the Server Load Balancer instance.
- The Server Load Balancer instance must be enabled.
- Health check must be enabled for all listener ports configured for the Server Load Balancer instance; otherwise, creation fails.
- The Server Load Balancer instance attached with VPC-type ECS instances cannot be attached to the scaling group.
- The default weight of an ECS instance attached to the Server Load Balancer instance is 50.

## Attributes Reference

The following attributes are exported:

* `id` - The scaling group ID.
* `min_size` - The minimum number of ECS instances.
* `max_size` - The maximum number of ECS instances.
* `scaling_group_name` - The name of the scaling group.
* `default_cooldown` - The default cool-down of the scaling group.
* `removal_policies` - The removal policy used to select the ECS instance to remove from the scaling group.
* `db_instance_ids` - The db instance id which the ECS instance attached to.
* `loadbalancer_ids` - The slb instance id which the ECS instance attached to.
59 changes: 59 additions & 0 deletions r/ess_scaling_rule.html.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
layout: "alicloud"
page_title: "Alicloud: alicloud_ess_scaling_rule"
sidebar_current: "docs-alicloud-resource-ess-scaling-rule"
description: |-
Provides a ESS scaling rule resource.
---

# alicloud\_ess\_scaling\_rule

Provides a ESS scaling rule resource.

## Example Usage

```
resource "alicloud_ess_scaling_group" "scaling" {
# Other parameters...
}
resource "alicloud_ess_scaling_configuration" "config" {
# Other parameters...
}
resource "alicloud_ess_scaling_rule" "rule" {
scaling_group_id = "${alicloud_ess_scaling_group.scaling.id}"
adjustment_type = "TotalCapacity"
adjustment_value = 2
cooldown = 60
}
```

## Argument Reference

The following arguments are supported:

* `scaling_group_id` - (Required) ID of the scaling group of a scaling rule.
* `adjustment_type` - (Required) Adjustment mode of a scaling rule. Optional values:
- QuantityChangeInCapacity: It is used to increase or decrease a specified number of ECS instances.
- PercentChangeInCapacity: It is used to increase or decrease a specified proportion of ECS instances.
- TotalCapacity: It is used to adjust the quantity of ECS instances in the current scaling group to a specified value.
* `adjustment_value` - (Required) Adjusted value of a scaling rule. Value range:
- QuantityChangeInCapacity:(0, 100] U (-100, 0]
- PercentChangeInCapacity:[0, 10000] U [-10000, 0]
- TotalCapacity:[0, 100]
* `scaling_rule_name` - (Optional) Name shown for the scaling rule, which is a string containing 2 to 40 English or Chinese characters.
* `cooldown` - (Optional) Cool-down time of a scaling rule. Value range: [0, 86,400], in seconds. The default value is empty.


## Attributes Reference

The following attributes are exported:

* `id` - The scaling rule ID.
* `scaling_group_id` - The id of scaling group.
* `ari` - Unique identifier of a scaling rule.
* `adjustment_type` - Adjustment mode of a scaling rule.
* `adjustment_value` - Adjustment value of a scaling rule.
* `scaling_rule_name` - Name of a scaling rule.
* `cooldown` - Cool-down time of a scaling rule.
Loading

0 comments on commit f476b86

Please sign in to comment.