diff --git a/CHANGELOG.md b/CHANGELOG.md index 8088cd7923..5735690184 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,9 @@ ENHANCEMENTS: +* Data Source: `tencentcloud_availability_zones` refactor logic with api3.0 . * Data Source: `tencentcloud_as_scaling_groups` add optional argument `tags` and attribute `tags` for `scaling_group_list`. +* Resource: `tencentcloud_eip` add optional argument `type`, `anycast_zone`, `internet_service_provider`, etc. * Resource: `tencentcloud_as_scaling_group` add optional argument `tags`. ## 1.20.0 (September 24, 2019) diff --git a/tencentcloud/data_source_tc_availability_zones.go b/tencentcloud/data_source_tc_availability_zones.go index 881faabd6a..fc84f9ae8b 100644 --- a/tencentcloud/data_source_tc_availability_zones.go +++ b/tencentcloud/data_source_tc_availability_zones.go @@ -1,17 +1,23 @@ +/* +Use this data source to get the available zones in the current region. By default only `AVAILABLE` zones will be returned, but `UNAVAILABLE` zones can also be fetched when `include_unavailable` is specified. + +Example Usage + +```hcl +data "tencentcloud_availability_zones" "my_favourite_zone" { + name = "ap-guangzhou-3" +} +``` +*/ package tencentcloud import ( - "encoding/json" - "errors" - "fmt" + "context" "log" + "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" -) - -const ( - // tencentCloudApiAvailibilityZoneStateAvailable = "AVAILABLE" - tencentCloudApiAvailibilityZoneStateUnavailable = "UNAVAILABLE" + cvm "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312" ) func dataSourceTencentCloudAvailabilityZones() *schema.Resource { @@ -20,38 +26,47 @@ func dataSourceTencentCloudAvailabilityZones() *schema.Resource { Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, + Type: schema.TypeString, + Optional: true, + Description: "When specified, only the zone with the exactly name match will return.", }, - "include_unavailable": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, + Type: schema.TypeBool, + Optional: true, + Description: "A bool variable indicates that the query will include `UNAVAILABLE` zones.", + }, + "result_output_file": { + Type: schema.TypeString, + Optional: true, + Description: "Used to save results.", }, // Computed values. "zones": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "A list of zones will be exported and its every element contains the following attributes:", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "An internal id for the zone, like `200003`, usually not so useful for end user.", }, "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The english name for the zone, like `ap-guangzhou-3`.", }, "description": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The description for the zone, unfortunately only Chinese characters at this stage.", }, "state": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The state for the zone, indicate availability using `AVAILABLE` and `UNAVAILABLE` values.", }, }, }, @@ -62,106 +77,66 @@ func dataSourceTencentCloudAvailabilityZones() *schema.Resource { func dataSourceTencentCloudAvailabilityZonesRead(d *schema.ResourceData, meta interface{}) error { defer logElapsed("data_source.tencentcloud_availability_zones.read")() - - client := meta.(*TencentCloudClient).commonConn - - params := map[string]string{ - "Version": "2017-03-12", - "Action": "DescribeZones", + logId := getLogId(contextNil) + ctx := context.WithValue(context.TODO(), "logId", logId) + cvmService := CvmService{ + client: meta.(*TencentCloudClient).apiV3Conn, } - log.Printf("[DEBUG] tencentcloud_instance_types - param: %v", params) - response, err := client.SendRequest("cvm", params) - if err != nil { - return err + var name string + var includeUnavailable = false + if v, ok := d.GetOk("name"); ok { + name = v.(string) } - - type Zone struct { - Zone string `json:"Zone"` - ZoneName string `json:"ZoneName"` - ZoneId string `json:"ZoneId"` - ZoneState string `json:"ZoneState"` + if v, ok := d.GetOkExists("include_unavailable"); ok { + includeUnavailable = v.(bool) } - var jsonresp struct { - Response struct { - Error struct { - Code string `json:"Code"` - Message string `json:"Message"` - } - RequestId string `json:"RequestId"` - ZoneSet []Zone + + var zones []*cvm.ZoneInfo + var errRet error + err := resource.Retry(readRetryTimeout, func() *resource.RetryError { + zones, errRet = cvmService.DescribeZones(ctx) + if errRet != nil { + return retryError(errRet, "InternalError") } - } - err = json.Unmarshal([]byte(response), &jsonresp) + return nil + }) if err != nil { return err } - if jsonresp.Response.Error.Code != "" { - return fmt.Errorf( - "tencentcloud_availability_zones got error, code:%v, message:%v", - jsonresp.Response.Error.Code, - jsonresp.Response.Error.Message, - ) - } - - var ( - resultZoneList []Zone - ) - zoneList := jsonresp.Response.ZoneSet - if len(zoneList) == 0 { - return errors.New("No avalability zones found") - } - - name, nameOk := d.GetOk("name") - includeUnavailable, includeUnavailableOk := d.GetOk("include_unavailable") - for _, zone := range zoneList { - log.Printf( - "[DEBUG] tencentcloud_availability_zones - Zone found id: %v, name:% v, description: %v, state: %v", - zone.ZoneId, - zone.Zone, - zone.ZoneName, - zone.ZoneState, - ) - if zone.ZoneState == tencentCloudApiAvailibilityZoneStateUnavailable { - if !includeUnavailableOk || !includeUnavailable.(bool) { - continue - } + zoneList := make([]map[string]interface{}, 0, len(zones)) + ids := make([]string, 0, len(zones)) + for _, zone := range zones { + if name != "" && name != *zone.Zone { + continue } - - if nameOk { - zoneName := name.(string) - if zone.Zone == zoneName { - resultZoneList = append(resultZoneList, zone) - } + if !includeUnavailable && *zone.ZoneState == ZONE_STATE_UNAVAILABLE { continue } - resultZoneList = append(resultZoneList, zone) - } - if len(resultZoneList) == 0 { - return errors.New("No avalability zones found") + mapping := map[string]interface{}{ + "id": zone.ZoneId, + "name": zone.Zone, + "description": zone.ZoneName, + "state": zone.ZoneState, + } + zoneList = append(zoneList, mapping) + ids = append(ids, *zone.ZoneId) } - var ( - result []map[string]interface{} - resultIds []string - ) - - for _, zone := range resultZoneList { - m := make(map[string]interface{}) - m["id"] = zone.ZoneId - m["name"] = zone.Zone - m["description"] = zone.ZoneName - m["state"] = zone.ZoneState - result = append(result, m) - resultIds = append(resultIds, zone.ZoneId) - } - id := dataResourceIdsHash(resultIds) - d.SetId(id) - log.Printf("[DEBUG] tencentcloud_availability_zones - instances[0]: %#v", result[0]) - if err := d.Set("zones", result); err != nil { + d.SetId(dataResourceIdsHash(ids)) + err = d.Set("zones", zoneList) + if err != nil { + log.Printf("[CRITAL]%s provider set zone list fail, reason:%s\n ", logId, err.Error()) return err } + + output, ok := d.GetOk("result_output_file") + if ok && output.(string) != "" { + if err := writeToFile(output.(string), zoneList); err != nil { + return err + } + } return nil } diff --git a/tencentcloud/extension_cvm.go b/tencentcloud/extension_cvm.go index 577764cb62..c8b64d4dfb 100644 --- a/tencentcloud/extension_cvm.go +++ b/tencentcloud/extension_cvm.go @@ -28,6 +28,9 @@ const ( CVM_PLACEMENT_GROUP_TYPE_HOST = "HOST" CVM_PLACEMENT_GROUP_TYPE_SW = "SW" CVM_PLACEMENT_GROUP_TYPE_RACK = "RACK" + + ZONE_STATE_AVAILABLE = "AVAILABLE" + ZONE_STATE_UNAVAILABLE = "UNAVAILABLE" ) var CVM_CHARGE_TYPE = []string{ diff --git a/tencentcloud/extension_vpc.go b/tencentcloud/extension_vpc.go index e8e90fdde5..8b2a8f0a6c 100644 --- a/tencentcloud/extension_vpc.go +++ b/tencentcloud/extension_vpc.go @@ -34,8 +34,36 @@ const ( EIP_STATUS_UNBIND = "UNBIND" EIP_STATUS_OFFLINING = "OFFLINING" EIP_STATUS_BIND_ENI = "BIND_ENI" + + EIP_TYPE_EIP = "EIP" + EIP_TYPE_ANYCAST = "AnycastEIP" + + EIP_ANYCAST_ZONE_GLOBAL = "ANYCAST_ZONE_GLOBAL" + EIP_ANYCAST_ZONE_OVERSEAS = "ANYCAST_ZONE_OVERSEAS" + + EIP_INTERNET_PROVIDER_BGP = "BGP" + EIP_INTERNET_PROVIDER_CMCC = "CMCC" + EIP_INTERNET_PROVIDER_CTCC = "CTCC" + EIP_INTERNET_PROVIDER_CUCC = "CUCC" ) +var EIP_INTERNET_PROVIDER = []string{ + EIP_INTERNET_PROVIDER_BGP, + EIP_INTERNET_PROVIDER_CMCC, + EIP_INTERNET_PROVIDER_CTCC, + EIP_INTERNET_PROVIDER_CUCC, +} + +var EIP_TYPE = []string{ + EIP_TYPE_EIP, + EIP_TYPE_ANYCAST, +} + +var EIP_ANYCAST_ZONE = []string{ + EIP_ANYCAST_ZONE_GLOBAL, + EIP_ANYCAST_ZONE_OVERSEAS, +} + // ENI const ( ENI_DESCRIBE_LIMIT = 100 diff --git a/tencentcloud/resource_tc_eip.go b/tencentcloud/resource_tc_eip.go index 93bd3ff04e..8ff93ca0f2 100644 --- a/tencentcloud/resource_tc_eip.go +++ b/tencentcloud/resource_tc_eip.go @@ -22,10 +22,12 @@ package tencentcloud import ( "context" "fmt" + "log" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" vpc "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312" + "github.com/terraform-providers/terraform-provider-tencentcloud/tencentcloud/ratelimit" ) func resourceTencentCloudEip() *schema.Resource { @@ -46,6 +48,48 @@ func resourceTencentCloudEip() *schema.Resource { ValidateFunc: validateStringLengthInRange(1, 20), Description: "The name of eip.", }, + "type": { + Type: schema.TypeString, + Optional: true, + Default: EIP_TYPE_EIP, + ForceNew: true, + ValidateFunc: validateAllowedStringValue(EIP_TYPE), + Description: "The type of eip, and available values include `EIP` and `AnycastEIP`. Default is `EIP`.", + }, + "anycast_zone": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validateAllowedStringValue(EIP_ANYCAST_ZONE), + Description: "The zone of anycast, and available values include `ANYCAST_ZONE_GLOBAL` and `ANYCAST_ZONE_OVERSEAS`.", + }, + "applicable_for_clb": { + Type: schema.TypeBool, + Optional: true, + ForceNew: true, + Description: "Indicates whether the anycast eip can be associated to a CLB.", + }, + "internet_service_provider": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validateAllowedStringValue(EIP_INTERNET_PROVIDER), + Description: "Internet service provider of eip, and available values include `BGP`, `CMCC`, `CTCC` and `CUCC`.", + }, + "internet_charge_type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validateAllowedStringValue(CVM_INTERNET_CHARGE_TYPE), + Description: "The charge type of eip, and available values include `BANDWIDTH_PACKAGE`, `BANDWIDTH_POSTPAID_BY_HOUR` and `TRAFFIC_POSTPAID_BY_HOUR`.", + }, + "internet_max_bandwidth_out": { + Type: schema.TypeInt, + Optional: true, + ForceNew: true, + ValidateFunc: validateIntegerInRange(1, 1000), + Description: "The bandwidth limit of eip, unit is Mbps, and the range is 1-1000.", + }, // computed "public_ip": { @@ -71,13 +115,43 @@ func resourceTencentCloudEipCreate(d *schema.ResourceData, meta interface{}) err client: meta.(*TencentCloudClient).apiV3Conn, } + request := vpc.NewAllocateAddressesRequest() + if v, ok := d.GetOk("type"); ok { + request.AddressType = stringToPointer(v.(string)) + } + if v, ok := d.GetOk("anycast_zone"); ok { + request.AnycastZone = stringToPointer(v.(string)) + } + if v, ok := d.GetOkExists("applicable_for_clb"); ok { + applicable := v.(bool) + request.ApplicableForCLB = &applicable + } + if v, ok := d.GetOk("internet_service_provider"); ok { + request.InternetServiceProvider = stringToPointer(v.(string)) + } + if v, ok := d.GetOk("internet_charge_type"); ok { + request.InternetChargeType = stringToPointer(v.(string)) + } + if v, ok := d.GetOk("internet_max_bandwidth_out"); ok { + request.InternetMaxBandwidthOut = int64ToPointer(v.(int)) + } + eipId := "" err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { - id, errRet := vpcService.CreateEip(ctx) - if errRet != nil { - return retryError(errRet) + ratelimit.Check(request.GetAction()) + response, err := meta.(*TencentCloudClient).apiV3Conn.UseVpcClient().AllocateAddresses(request) + if err != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, request.GetAction(), request.ToJsonString(), err.Error()) + return retryError(err) + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + + if len(response.Response.AddressSet) < 1 { + return resource.NonRetryableError(fmt.Errorf("eip id is nil")) } - eipId = id + eipId = *response.Response.AddressSet[0] return nil }) if err != nil { @@ -145,6 +219,7 @@ func resourceTencentCloudEipRead(d *schema.ResourceData, meta interface{}) error } d.Set("name", eip.AddressName) + d.Set("type", eip.AddressType) d.Set("public_ip", eip.AddressIp) d.Set("status", eip.AddressStatus) return nil diff --git a/tencentcloud/resource_tc_eip_test.go b/tencentcloud/resource_tc_eip_test.go index 0e1a0d2451..bd32c67767 100644 --- a/tencentcloud/resource_tc_eip_test.go +++ b/tencentcloud/resource_tc_eip_test.go @@ -50,6 +50,60 @@ func TestAccTencentCloudEip_basic(t *testing.T) { }) } +func TestAccTencentCloudEip_anycast(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckEipDestroy, + Steps: []resource.TestStep{ + { + Config: testAccEipAnycast, + Check: resource.ComposeTestCheckFunc( + testAccCheckEipExists("tencentcloud_eip.foo"), + resource.TestCheckResourceAttr("tencentcloud_eip.foo", "name", "eip_anycast"), + resource.TestCheckResourceAttr("tencentcloud_eip.foo", "type", "AnycastEIP"), + ), + }, + }, + }) +} + +func TestAccTencentCloudEip_provider(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckEipDestroy, + Steps: []resource.TestStep{ + { + Config: testAccEipProvider, + Check: resource.ComposeTestCheckFunc( + testAccCheckEipExists("tencentcloud_eip.foo"), + resource.TestCheckResourceAttr("tencentcloud_eip.foo", "name", "eip_provider"), + resource.TestCheckResourceAttr("tencentcloud_eip.foo", "type", "EIP"), + ), + }, + }, + }) +} + +func TestAccTencentCloudEip_bandwidth(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckEipDestroy, + Steps: []resource.TestStep{ + { + Config: testAccEipBandwidth, + Check: resource.ComposeTestCheckFunc( + testAccCheckEipExists("tencentcloud_eip.foo"), + resource.TestCheckResourceAttr("tencentcloud_eip.foo", "name", "eip_bandwidth"), + resource.TestCheckResourceAttr("tencentcloud_eip.foo", "type", "EIP"), + ), + }, + }, + }) +} + func testAccCheckEipExists(n string) resource.TestCheckFunc { return func(s *terraform.State) error { logId := getLogId(contextNil) @@ -132,3 +186,27 @@ const testAccEipBasicWithoutName = ` resource "tencentcloud_eip" "bar" { } ` + +const testAccEipAnycast = ` +resource "tencentcloud_eip" "foo" { + name = "eip_anycast" + type = "AnycastEIP" + anycast_zone = "ANYCAST_ZONE_GLOBAL" + applicable_for_clb = false +} +` + +const testAccEipProvider = ` +resource "tencentcloud_eip" "foo" { + name = "eip_provider" + internet_service_provider = "CMCC" +} +` + +const testAccEipBandwidth = ` +resource "tencentcloud_eip" "foo" { + name = "eip_bandwidth" + internet_charge_type = "TRAFFIC_POSTPAID_BY_HOUR" + internet_max_bandwidth_out = 2 + } +` diff --git a/tencentcloud/resource_tc_instance.go b/tencentcloud/resource_tc_instance.go index ac5d521855..792da8e131 100644 --- a/tencentcloud/resource_tc_instance.go +++ b/tencentcloud/resource_tc_instance.go @@ -184,12 +184,11 @@ func resourceTencentCloudInstance() *schema.Resource { Description: "Internet charge type of the instance, Valid values are `BANDWIDTH_PREPAID`, `TRAFFIC_POSTPAID_BY_HOUR`, `BANDWIDTH_POSTPAID_BY_HOUR` and `BANDWIDTH_PACKAGE`. The default is `TRAFFIC_POSTPAID_BY_HOUR`.", }, "internet_max_bandwidth_out": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - ForceNew: true, - ValidateFunc: validateIntegerInRange(0, 100), - Description: "Maximum outgoing bandwidth to the public network, measured in Mbps (Mega bit per second). Value range: [0, 100], If this value is not specified, then automatically sets it to 0 Mbps.", + Type: schema.TypeInt, + Optional: true, + Default: 0, + ForceNew: true, + Description: "Maximum outgoing bandwidth to the public network, measured in Mbps (Mega bit per second). If this value is not specified, then automatically sets it to 0 Mbps.", }, "allocate_public_ip": { Type: schema.TypeBool, diff --git a/tencentcloud/resource_tc_redis_instance.go b/tencentcloud/resource_tc_redis_instance.go index 4ad4d4bf08..1802d1ff29 100644 --- a/tencentcloud/resource_tc_redis_instance.go +++ b/tencentcloud/resource_tc_redis_instance.go @@ -264,7 +264,7 @@ func resourceTencentCloudRedisInstanceRead(d *schema.ResourceData, meta interfac statusName := REDIS_STATUS[*info.Status] if statusName == "" { - err = fmt.Errorf("redis read unkwnow status %d", *info.ZoneId) + err = fmt.Errorf("redis read unkwnow status %d", *info.Status) log.Printf("[CRITAL]%s redis read status name error, reason:%s\n", logId, err.Error()) return err } diff --git a/tencentcloud/service_tencentcloud_cvm.go b/tencentcloud/service_tencentcloud_cvm.go index 1239e4930a..80e795586c 100644 --- a/tencentcloud/service_tencentcloud_cvm.go +++ b/tencentcloud/service_tencentcloud_cvm.go @@ -589,6 +589,25 @@ func (me *CvmService) DeletePlacementGroup(ctx context.Context, placementId stri return nil } +func (me *CvmService) DescribeZones(ctx context.Context) (zones []*cvm.ZoneInfo, errRet error) { + logId := getLogId(ctx) + request := cvm.NewDescribeZonesRequest() + + ratelimit.Check(request.GetAction()) + response, err := me.client.UseCvmClient().DescribeZones(request) + if err != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, request.GetAction(), request.ToJsonString(), err.Error()) + errRet = err + return + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", + logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + + zones = response.Response.ZoneSet + return +} + func flattenCvmTagsMapping(tags []*cvm.Tag) (mapping map[string]string) { mapping = make(map[string]string) for _, tag := range tags { diff --git a/tencentcloud/service_tencentcloud_vpc.go b/tencentcloud/service_tencentcloud_vpc.go index e6facd3761..947c0324dc 100644 --- a/tencentcloud/service_tencentcloud_vpc.go +++ b/tencentcloud/service_tencentcloud_vpc.go @@ -1599,29 +1599,6 @@ func parseRule(str string) (liteRule VpcSecurityGroupLiteRule, err error) { /* EIP */ -func (me *VpcService) CreateEip(ctx context.Context) (eipId string, errRet error) { - logId := getLogId(ctx) - request := vpc.NewAllocateAddressesRequest() - - ratelimit.Check(request.GetAction()) - response, err := me.client.UseVpcClient().AllocateAddresses(request) - if err != nil { - log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", - logId, request.GetAction(), request.ToJsonString(), err.Error()) - errRet = err - return - } - log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", - logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) - - if len(response.Response.AddressSet) < 1 { - errRet = fmt.Errorf("eip id is nil") - return - } - eipId = *response.Response.AddressSet[0] - return -} - func (me *VpcService) DescribeEipById(ctx context.Context, eipId string) (eip *vpc.Address, errRet error) { logId := getLogId(ctx) request := vpc.NewDescribeAddressesRequest() diff --git a/website/docs/d/availability_zones.html.markdown b/website/docs/d/availability_zones.html.markdown new file mode 100644 index 0000000000..51e47b1cc8 --- /dev/null +++ b/website/docs/d/availability_zones.html.markdown @@ -0,0 +1,39 @@ +--- +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_availability_zones" +sidebar_current: "docs-tencentcloud-datasource-availability_zones" +description: |- + Use this data source to get the available zones in the current region. By default only `AVAILABLE` zones will be returned, but `UNAVAILABLE` zones can also be fetched when `include_unavailable` is specified. +--- + +# tencentcloud_availability_zones + +Use this data source to get the available zones in the current region. By default only `AVAILABLE` zones will be returned, but `UNAVAILABLE` zones can also be fetched when `include_unavailable` is specified. + +## Example Usage + +```hcl +data "tencentcloud_availability_zones" "my_favourite_zone" { + name = "ap-guangzhou-3" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `include_unavailable` - (Optional) A bool variable indicates that the query will include `UNAVAILABLE` zones. +* `name` - (Optional) When specified, only the zone with the exactly name match will return. +* `result_output_file` - (Optional) Used to save results. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `zones` - A list of zones will be exported and its every element contains the following attributes: + * `description` - The description for the zone, unfortunately only Chinese characters at this stage. + * `id` - An internal id for the zone, like `200003`, usually not so useful for end user. + * `name` - The english name for the zone, like `ap-guangzhou-3`. + * `state` - The state for the zone, indicate availability using `AVAILABLE` and `UNAVAILABLE` values. + + diff --git a/website/docs/d/availability_zones.html.md b/website/docs/d/availability_zones.html.md deleted file mode 100644 index 416745ff38..0000000000 --- a/website/docs/d/availability_zones.html.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -layout: "tencentcloud" -page_title: "TencentCloud: tencentcloud_availability_zones" -sidebar_current: "docs-tencentcloud-datasource-availability-zones" -description: |- - Get available zones in the current region. ---- - -# tencentcloud_availability_zones - -Use this data source to get the available zones in the current region. -By default only `AVAILABLE` zones will be returned, but `UNAVAILABLE` zones -can also be fetched when `include_unavailable` is specified. - -## Example Usage - -```hcl -data "tencentcloud_availability_zones" "my_favourite_zone" { - name = "ap-guangzhou-3" -} -``` - -## Argument Reference - - * `include_unavailable` - (Optional) A bool variable Indicates that the query will include `UNAVAILABLE` zones. - * `name` - (Optional) When specified, only the zone with the exactly name match will return. - -## Attributes Reference - -A list of zones will be exported and its every element contains the following attributes: - - * `id` - An internal id for the zone, like `200003`, usually not so useful for end user. - * `name` - The english name for the zone, like `ap-guangzhou-3`. - * `description` - The description for the zone, unfortunately only Chinese characters at this stage. - * `state` - The state for the zone, indicate availability using `AVAILABLE` and `UNAVAILABLE` values. diff --git a/website/docs/r/eip.html.markdown b/website/docs/r/eip.html.markdown index c6710a5298..b08f6465a0 100644 --- a/website/docs/r/eip.html.markdown +++ b/website/docs/r/eip.html.markdown @@ -22,7 +22,13 @@ resource "tencentcloud_eip" "foo" { The following arguments are supported: +* `anycast_zone` - (Optional, ForceNew) The zone of anycast, and available values include `ANYCAST_ZONE_GLOBAL` and `ANYCAST_ZONE_OVERSEAS`. +* `applicable_for_clb` - (Optional, ForceNew) Indicates whether the anycast eip can be associated to a CLB. +* `internet_charge_type` - (Optional, ForceNew) The charge type of eip, and available values include `BANDWIDTH_PACKAGE`, `BANDWIDTH_POSTPAID_BY_HOUR` and `TRAFFIC_POSTPAID_BY_HOUR`. +* `internet_max_bandwidth_out` - (Optional, ForceNew) The bandwidth limit of eip, unit is Mbps, and the range is 1-1000. +* `internet_service_provider` - (Optional, ForceNew) Internet service provider of eip, and available values include `BGP`, `CMCC`, `CTCC` and `CUCC`. * `name` - (Optional) The name of eip. +* `type` - (Optional, ForceNew) The type of eip, and available values include `EIP` and `AnycastEIP`. Default is `EIP`. ## Attributes Reference diff --git a/website/docs/r/instance.html.markdown b/website/docs/r/instance.html.markdown index 024bc2085e..c00671fa59 100644 --- a/website/docs/r/instance.html.markdown +++ b/website/docs/r/instance.html.markdown @@ -94,7 +94,7 @@ The following arguments are supported: * `instance_name` - (Optional) The name of the CVM. The max length of instance_name is 60, and default value is `Terrafrom-CVM-Instance`. * `instance_type` - (Optional, ForceNew) The type of instance to start. * `internet_charge_type` - (Optional, ForceNew) Internet charge type of the instance, Valid values are `BANDWIDTH_PREPAID`, `TRAFFIC_POSTPAID_BY_HOUR`, `BANDWIDTH_POSTPAID_BY_HOUR` and `BANDWIDTH_PACKAGE`. The default is `TRAFFIC_POSTPAID_BY_HOUR`. -* `internet_max_bandwidth_out` - (Optional, ForceNew) Maximum outgoing bandwidth to the public network, measured in Mbps (Mega bit per second). Value range: [0, 100], If this value is not specified, then automatically sets it to 0 Mbps. +* `internet_max_bandwidth_out` - (Optional, ForceNew) Maximum outgoing bandwidth to the public network, measured in Mbps (Mega bit per second). If this value is not specified, then automatically sets it to 0 Mbps. * `key_name` - (Optional) The key pair to use for the instance, it looks like skey-16jig7tx. * `password` - (Optional) Password to an instance. In order to take effect new password, the instance will be restarted after modifying the password. * `placement_group_id` - (Optional, ForceNew) The id of a placement group.