Skip to content

Commit

Permalink
Merge branch 'feat/unsubscribe' into 'master'
Browse files Browse the repository at this point in the history
feat: 优化包年包月实例的退订逻辑,更新私网连接资源的使用示例

See merge request iaasng/terraform-provider-volcengine!513
  • Loading branch information
msq177 committed May 16, 2024
2 parents df1692b + b32654f commit 23e8c20
Show file tree
Hide file tree
Showing 12 changed files with 68 additions and 17 deletions.
2 changes: 1 addition & 1 deletion common/common_volcengine_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func ResourceFlowLimitExceededError(err error) bool {
}

func UnsubscribeProductError(err error) bool {
return strings.Contains(err.Error(), "The product code is inconsistent with the instance product")
return strings.Contains(err.Error(), "The product code does not match the instance's product")
}

func UnsubscribeProductConflictError(err error) bool {
Expand Down
2 changes: 1 addition & 1 deletion common/common_volcengine_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ package common

const (
TerraformProviderName = "terraform-provider-volcengine"
TerraformProviderVersion = "0.0.143"
TerraformProviderVersion = "0.0.144"
)
7 changes: 7 additions & 0 deletions example/dataPrivatelinkVpcEndpointConnections/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,16 @@ resource "volcengine_privatelink_vpc_endpoint" "foo" {
description = "acc-test"
}

resource "volcengine_privatelink_vpc_endpoint_zone" "foo" {
endpoint_id = volcengine_privatelink_vpc_endpoint.foo.id
subnet_id = volcengine_subnet.foo.id
private_ip_address = "172.16.0.251"
}

resource "volcengine_privatelink_vpc_endpoint_connection" "foo" {
endpoint_id = volcengine_privatelink_vpc_endpoint.foo.id
service_id = volcengine_privatelink_vpc_endpoint_service.foo.id
depends_on = [volcengine_privatelink_vpc_endpoint_zone.foo]
}

data "volcengine_privatelink_vpc_endpoint_connections" "foo"{
Expand Down
12 changes: 12 additions & 0 deletions example/privatelinkVpcEndpointConnection/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,19 @@ resource "volcengine_privatelink_vpc_endpoint" "foo" {
description = "acc-test"
}

#resource "volcengine_privatelink_vpc_endpoint_connection" "foo" {
# endpoint_id = volcengine_privatelink_vpc_endpoint.foo.id
# service_id = volcengine_privatelink_vpc_endpoint_service.foo.id
#}

resource "volcengine_privatelink_vpc_endpoint_zone" "foo" {
endpoint_id = volcengine_privatelink_vpc_endpoint.foo.id
subnet_id = volcengine_subnet.foo.id
private_ip_address = "172.16.0.251"
}

resource "volcengine_privatelink_vpc_endpoint_connection" "foo" {
endpoint_id = volcengine_privatelink_vpc_endpoint.foo.id
service_id = volcengine_privatelink_vpc_endpoint_service.foo.id
depends_on = [volcengine_privatelink_vpc_endpoint_zone.foo]
}
9 changes: 4 additions & 5 deletions volcengine/clb/clb/resource_volcengine_clb.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,10 @@ func ResourceVolcengineClb() *schema.Resource {
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"isp": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{"BGP"}, false),
Description: "The ISP of the EIP which automatically associated to CLB, the value can be `BGP`.",
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: "The ISP of the EIP which automatically associated to CLB, the value can be `BGP` or `ChinaMobile` or `ChinaUnicom` or `ChinaTelecom` or `SingleLine_BGP` or `Static_BGP` or `Fusion_BGP`.",
},
"eip_billing_type": {
Type: schema.TypeString,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,16 @@ resource "volcengine_privatelink_vpc_endpoint" "foo" {
description = "acc-test"
}
resource "volcengine_privatelink_vpc_endpoint_zone" "foo" {
endpoint_id = volcengine_privatelink_vpc_endpoint.foo.id
subnet_id = volcengine_subnet.foo.id
private_ip_address = "172.16.0.251"
}
resource "volcengine_privatelink_vpc_endpoint_connection" "foo" {
endpoint_id = volcengine_privatelink_vpc_endpoint.foo.id
service_id = volcengine_privatelink_vpc_endpoint_service.foo.id
depends_on = [volcengine_privatelink_vpc_endpoint_zone.foo]
}
data "volcengine_privatelink_vpc_endpoint_connections" "foo"{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,16 @@ resource "volcengine_privatelink_vpc_endpoint" "foo" {
description = "acc-test"
}
resource "volcengine_privatelink_vpc_endpoint_zone" "foo" {
endpoint_id = volcengine_privatelink_vpc_endpoint.foo.id
subnet_id = volcengine_subnet.foo.id
private_ip_address = "172.16.0.251"
}
resource "volcengine_privatelink_vpc_endpoint_connection" "foo" {
endpoint_id = volcengine_privatelink_vpc_endpoint.foo.id
service_id = volcengine_privatelink_vpc_endpoint_service.foo.id
depends_on = [volcengine_privatelink_vpc_endpoint_zone.foo]
}
`

Expand Down
14 changes: 7 additions & 7 deletions volcengine/tos/object/resource_volcengine_tos_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ func ResourceVolcengineTosObject() *schema.Resource {
Type: schema.TypeString,
Optional: true,
//ForceNew: true,
Description: "The file path for upload.",
ConflictsWith: []string{"content"},
Description: "The file path for upload. Only one of `file_path,content` can be specified.",
ExactlyOneOf: []string{"file_path", "content"},
},
"content_md5": {
Type: schema.TypeString,
Expand Down Expand Up @@ -164,11 +164,11 @@ func ResourceVolcengineTosObject() *schema.Resource {
Description: "The flag of enable tos version.",
},
"content": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ConflictsWith: []string{"file_path"},
Description: "The content the TOS Object when content type is json or text and xml.",
Type: schema.TypeString,
Optional: true,
Computed: true,
ExactlyOneOf: []string{"file_path", "content"},
Description: "The content of the TOS Object when content type is json or text and xml. Only one of `file_path,content` can be specified.",
},
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,16 @@ resource "volcengine_privatelink_vpc_endpoint" "foo" {
description = "acc-test"
}
resource "volcengine_privatelink_vpc_endpoint_zone" "foo" {
endpoint_id = volcengine_privatelink_vpc_endpoint.foo.id
subnet_id = volcengine_subnet.foo.id
private_ip_address = "172.16.0.251"
}
resource "volcengine_privatelink_vpc_endpoint_connection" "foo" {
endpoint_id = volcengine_privatelink_vpc_endpoint.foo.id
service_id = volcengine_privatelink_vpc_endpoint_service.foo.id
depends_on = [volcengine_privatelink_vpc_endpoint_zone.foo]
}
data "volcengine_privatelink_vpc_endpoint_connections" "foo" {
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/clb.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ When the value of this field is `DualStack`, the type of the CLB must be `privat
The `eip_billing_config` object supports the following:

* `eip_billing_type` - (Required, ForceNew) The billing type of the EIP which automatically assigned to CLB. And optional choice contains `PostPaidByBandwidth` or `PostPaidByTraffic` or `PrePaid`.When creating a `PrePaid` public CLB, this field must be specified as `PrePaid` simultaneously.When the LoadBalancerBillingType changes from `PostPaid` to `PrePaid`, please manually modify the value of this field to `PrePaid` simultaneously.
* `isp` - (Required, ForceNew) The ISP of the EIP which automatically associated to CLB, the value can be `BGP`.
* `isp` - (Required, ForceNew) The ISP of the EIP which automatically associated to CLB, the value can be `BGP` or `ChinaMobile` or `ChinaUnicom` or `ChinaTelecom` or `SingleLine_BGP` or `Static_BGP` or `Fusion_BGP`.
* `bandwidth` - (Optional) The peek bandwidth of the EIP which automatically assigned to CLB.

The `tags` object supports the following:
Expand Down
12 changes: 12 additions & 0 deletions website/docs/r/privatelink_vpc_endpoint_connection.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,21 @@ resource "volcengine_privatelink_vpc_endpoint" "foo" {
description = "acc-test"
}
#resource "volcengine_privatelink_vpc_endpoint_connection" "foo" {
# endpoint_id = volcengine_privatelink_vpc_endpoint.foo.id
# service_id = volcengine_privatelink_vpc_endpoint_service.foo.id
#}
resource "volcengine_privatelink_vpc_endpoint_zone" "foo" {
endpoint_id = volcengine_privatelink_vpc_endpoint.foo.id
subnet_id = volcengine_subnet.foo.id
private_ip_address = "172.16.0.251"
}
resource "volcengine_privatelink_vpc_endpoint_connection" "foo" {
endpoint_id = volcengine_privatelink_vpc_endpoint.foo.id
service_id = volcengine_privatelink_vpc_endpoint_service.foo.id
depends_on = [volcengine_privatelink_vpc_endpoint_zone.foo]
}
```
## Argument Reference
Expand Down
4 changes: 2 additions & 2 deletions website/docs/r/tos_object.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ resource "volcengine_tos_object" "default" {
## Argument Reference
The following arguments are supported:
* `bucket_name` - (Required, ForceNew) The name of the bucket.
* `file_path` - (Required) The file path for upload.
* `object_name` - (Required, ForceNew) The name of the object.
* `account_acl` - (Optional) The user set of grant full control.
* `content_md5` - (Optional) The file md5 sum (32-bit hexadecimal string) for upload.
* `content_type` - (Optional, ForceNew) The content type of the object.
* `content` - (Optional) The content of the TOS Object when content type is json or text and xml. Only one of `file_path,content` can be specified.
* `encryption` - (Optional, ForceNew) The encryption of the object.Valid value is AES256.
* `file_path` - (Optional) The file path for upload. Only one of `file_path,content` can be specified.
* `public_acl` - (Optional) The public acl control of object.Valid value is private|public-read|public-read-write|authenticated-read|bucket-owner-read.
* `storage_class` - (Optional, ForceNew) The storage type of the object.Valid value is STANDARD|IA.

Expand All @@ -52,7 +53,6 @@ The `account_acl` object supports the following:
## Attributes Reference
In addition to all arguments above, the following attributes are exported:
* `id` - ID of the resource.
* `content` - The content the TOS Object when content type is json or text and xml.
* `enable_version` - The flag of enable tos version.
* `version_ids` - The version ids of the object if exist.

Expand Down

0 comments on commit 23e8c20

Please sign in to comment.