diff --git a/common/common_volcengine_error.go b/common/common_volcengine_error.go index 6ffce31f..7f2bf6a3 100644 --- a/common/common_volcengine_error.go +++ b/common/common_volcengine_error.go @@ -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 { diff --git a/common/common_volcengine_version.go b/common/common_volcengine_version.go index b21598c7..0b2b986c 100644 --- a/common/common_volcengine_version.go +++ b/common/common_volcengine_version.go @@ -2,5 +2,5 @@ package common const ( TerraformProviderName = "terraform-provider-volcengine" - TerraformProviderVersion = "0.0.143" + TerraformProviderVersion = "0.0.144" ) diff --git a/example/dataPrivatelinkVpcEndpointConnections/main.tf b/example/dataPrivatelinkVpcEndpointConnections/main.tf index 1270d10b..97d77539 100644 --- a/example/dataPrivatelinkVpcEndpointConnections/main.tf +++ b/example/dataPrivatelinkVpcEndpointConnections/main.tf @@ -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"{ diff --git a/example/privatelinkVpcEndpointConnection/main.tf b/example/privatelinkVpcEndpointConnection/main.tf index 8c9c8113..d3610177 100644 --- a/example/privatelinkVpcEndpointConnection/main.tf +++ b/example/privatelinkVpcEndpointConnection/main.tf @@ -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] } diff --git a/volcengine/clb/clb/resource_volcengine_clb.go b/volcengine/clb/clb/resource_volcengine_clb.go index b773cc5c..caa9be16 100644 --- a/volcengine/clb/clb/resource_volcengine_clb.go +++ b/volcengine/clb/clb/resource_volcengine_clb.go @@ -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, diff --git a/volcengine/privatelink/vpc_endpoint_connection/data_source_volcengine_privatelink_vpc_endpoint_connections_test.go b/volcengine/privatelink/vpc_endpoint_connection/data_source_volcengine_privatelink_vpc_endpoint_connections_test.go index 478a13ee..d6a5c4e2 100644 --- a/volcengine/privatelink/vpc_endpoint_connection/data_source_volcengine_privatelink_vpc_endpoint_connections_test.go +++ b/volcengine/privatelink/vpc_endpoint_connection/data_source_volcengine_privatelink_vpc_endpoint_connections_test.go @@ -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"{ diff --git a/volcengine/privatelink/vpc_endpoint_connection/resource_volcengine_privatelink_vpc_endpoint_connection_test.go b/volcengine/privatelink/vpc_endpoint_connection/resource_volcengine_privatelink_vpc_endpoint_connection_test.go index 4fd3b296..389d14a9 100644 --- a/volcengine/privatelink/vpc_endpoint_connection/resource_volcengine_privatelink_vpc_endpoint_connection_test.go +++ b/volcengine/privatelink/vpc_endpoint_connection/resource_volcengine_privatelink_vpc_endpoint_connection_test.go @@ -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] } ` diff --git a/volcengine/tos/object/resource_volcengine_tos_object.go b/volcengine/tos/object/resource_volcengine_tos_object.go index 9632c8bc..8da29f9f 100644 --- a/volcengine/tos/object/resource_volcengine_tos_object.go +++ b/volcengine/tos/object/resource_volcengine_tos_object.go @@ -63,9 +63,10 @@ func ResourceVolcengineTosObject() *schema.Resource { }, "file_path": { Type: schema.TypeString, - Required: true, + Optional: true, //ForceNew: true, - Description: "The file path for upload.", + 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, @@ -163,9 +164,11 @@ func ResourceVolcengineTosObject() *schema.Resource { Description: "The flag of enable tos version.", }, "content": { - Type: schema.TypeString, - Computed: true, - 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.", }, }, } diff --git a/volcengine/tos/object/service_volcengine_tos_object.go b/volcengine/tos/object/service_volcengine_tos_object.go index 5b75a8c0..c5ff5a09 100644 --- a/volcengine/tos/object/service_volcengine_tos_object.go +++ b/volcengine/tos/object/service_volcengine_tos_object.go @@ -5,6 +5,7 @@ import ( "encoding/hex" "fmt" "net/http" + "os" "strings" "time" @@ -252,7 +253,7 @@ func (s *VolcengineTosObjectService) CreateResource(resourceData *schema.Resourc func (s *VolcengineTosObjectService) ModifyResource(data *schema.ResourceData, resource *schema.Resource) []ve.Callback { var callbacks []ve.Callback - if data.HasChange("file_path") || data.HasChanges("content_md5") { + if data.HasChange("file_path") || data.HasChanges("content_md5") || data.HasChanges("content") { callbacks = append(callbacks, s.createOrReplaceObject(data, resource, true)) callbacks = append(callbacks, s.createOrUpdateObjectAcl(data, resource, true)) } else { @@ -511,6 +512,7 @@ func (s *VolcengineTosObjectService) createOrUpdateObjectAcl(resourceData *schem } func (s *VolcengineTosObjectService) createOrReplaceObject(resourceData *schema.ResourceData, resource *schema.Resource, isUpdate bool) ve.Callback { + name := fmt.Sprintf("./%d-temp", time.Now().Unix()) return ve.Callback{ Call: ve.SdkCall{ ServiceCategory: ve.ServiceBypass, @@ -558,6 +560,13 @@ func (s *VolcengineTosObjectService) createOrReplaceObject(resourceData *schema. }, ForceGet: isUpdate, }, + "content": { + ConvertType: ve.ConvertDefault, + TargetField: "Content", + SpecialParam: &ve.SpecialParam{ + Type: ve.HeaderParam, + }, + }, "content_md5": { ConvertType: ve.ConvertDefault, TargetField: "Content-MD5", @@ -591,6 +600,15 @@ func (s *VolcengineTosObjectService) createOrReplaceObject(resourceData *schema. if _, ok := (*call.SdkParam)[ve.BypassHeader].(map[string]string)["Content-MD5"]; ok { (*call.SdkParam)[ve.BypassHeader].(map[string]string)["x-tos-meta-content-md5"] = d.Get("content_md5").(string) } + if _, ok := (*call.SdkParam)[ve.BypassHeader].(map[string]string)["Content"]; ok { + content := []byte(d.Get("content").(string)) + err := os.WriteFile(name, content, 0644) + if err != nil { + return false, err + } + (*call.SdkParam)[ve.BypassFilePath] = name + delete((*call.SdkParam)[ve.BypassHeader].(map[string]string), "Content") + } return true, nil }, ExecuteCall: func(d *schema.ResourceData, client *ve.SdkClient, call ve.SdkCall) (*map[string]interface{}, error) { @@ -606,7 +624,14 @@ func (s *VolcengineTosObjectService) createOrReplaceObject(resourceData *schema. }, AfterCall: func(d *schema.ResourceData, client *ve.SdkClient, resp *map[string]interface{}, call ve.SdkCall) error { d.SetId((*call.SdkParam)[ve.BypassDomain].(string) + ":" + (*call.SdkParam)[ve.BypassPath].([]string)[0]) - return nil + _, err := os.Stat(name) + if err == nil { + return os.Remove(name) + } + if os.IsNotExist(err) { + return nil + } + return err }, }, } diff --git a/website/docs/d/privatelink_vpc_endpoint_connections.html.markdown b/website/docs/d/privatelink_vpc_endpoint_connections.html.markdown index 5c711a8e..b1b480cb 100644 --- a/website/docs/d/privatelink_vpc_endpoint_connections.html.markdown +++ b/website/docs/d/privatelink_vpc_endpoint_connections.html.markdown @@ -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" { diff --git a/website/docs/r/clb.html.markdown b/website/docs/r/clb.html.markdown index b70ebda1..501ceb2a 100644 --- a/website/docs/r/clb.html.markdown +++ b/website/docs/r/clb.html.markdown @@ -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: diff --git a/website/docs/r/privatelink_vpc_endpoint_connection.html.markdown b/website/docs/r/privatelink_vpc_endpoint_connection.html.markdown index bf550378..4f19c317 100644 --- a/website/docs/r/privatelink_vpc_endpoint_connection.html.markdown +++ b/website/docs/r/privatelink_vpc_endpoint_connection.html.markdown @@ -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 diff --git a/website/docs/r/tos_object.html.markdown b/website/docs/r/tos_object.html.markdown index 26b373df..a07abd78 100644 --- a/website/docs/r/tos_object.html.markdown +++ b/website/docs/r/tos_object.html.markdown @@ -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. @@ -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.