diff --git a/tencentcloud/basic_test.go b/tencentcloud/basic_test.go index 54b668738f..7501079111 100644 --- a/tencentcloud/basic_test.go +++ b/tencentcloud/basic_test.go @@ -66,6 +66,7 @@ const ( defaultTkeOSImageId = "img-2lr9q49h" defaultTkeOSImageName = "tlinux2.2(tkernel3)x86_64" + defaultEMRSgId = "sg-qyy7jd2b" ) // Tke Exclusive Network Environment diff --git a/tencentcloud/resource_tc_emr_cluster.go b/tencentcloud/resource_tc_emr_cluster.go index 22b07c1880..2f8eb67375 100644 --- a/tencentcloud/resource_tc_emr_cluster.go +++ b/tencentcloud/resource_tc_emr_cluster.go @@ -171,6 +171,11 @@ func resourceTencentCloudEmrCluster() *schema.Resource { ForceNew: true, Description: "Instance login settings.", }, + "extend_fs_field": { + Type: schema.TypeString, + Optional: true, + Description: "Access the external file system.", + }, "instance_id": { Type: schema.TypeString, Computed: true, @@ -229,6 +234,9 @@ func resourceTencentCloudEmrClusterUpdate(d *schema.ResourceData, meta interface if d.HasChange("resource_spec.0.core_count") { request.CoreCount = common.Uint64Ptr((uint64)(resourceSpec["core_count"].(int))) } + if d.HasChange("extend_fs_field") { + return innerErr.New("extend_fs_field not support update.") + } _, err := emrService.UpdateInstance(ctx, request) if err != nil { return err diff --git a/tencentcloud/resource_tc_emr_cluster_test.go b/tencentcloud/resource_tc_emr_cluster_test.go index 02c221d15a..63280cd1a5 100644 --- a/tencentcloud/resource_tc_emr_cluster_test.go +++ b/tencentcloud/resource_tc_emr_cluster_test.go @@ -19,13 +19,13 @@ func TestAccTencentCloudEmrClusterResource(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testEmrBasic, + Config: testEmrBasic(), Check: resource.ComposeTestCheckFunc( testAccCheckEmrExists(testEmrClusterResourceKey), resource.TestCheckResourceAttr(testEmrClusterResourceKey, "product_id", "4"), resource.TestCheckResourceAttr(testEmrClusterResourceKey, "display_strategy", "clusterList"), - resource.TestCheckResourceAttr(testEmrClusterResourceKey, "vpc_settings.vpc_id", "vpc-i9zty99n"), - resource.TestCheckResourceAttr(testEmrClusterResourceKey, "vpc_settings.subnet_id", "subnet-opwnh0sw"), + resource.TestCheckResourceAttr(testEmrClusterResourceKey, "vpc_settings.vpc_id", defaultVpcId), + resource.TestCheckResourceAttr(testEmrClusterResourceKey, "vpc_settings.subnet_id", defaultSubnetId), resource.TestCheckResourceAttr(testEmrClusterResourceKey, "softwares.0", "zookeeper-3.6.1"), resource.TestCheckResourceAttr(testEmrClusterResourceKey, "support_ha", "0"), resource.TestCheckResourceAttr(testEmrClusterResourceKey, "instance_name", "emr-test-demo"), @@ -37,7 +37,7 @@ func TestAccTencentCloudEmrClusterResource(t *testing.T) { resource.TestCheckResourceAttr(testEmrClusterResourceKey, "placement.zone", "ap-guangzhou-3"), resource.TestCheckResourceAttr(testEmrClusterResourceKey, "placement.project_id", "0"), resource.TestCheckResourceAttrSet(testEmrClusterResourceKey, "instance_id"), - resource.TestCheckResourceAttr(testEmrClusterResourceKey, "sg_id", "sg-qyy7jd2b"), + resource.TestCheckResourceAttr(testEmrClusterResourceKey, "sg_id", defaultEMRSgId), ), }, }, @@ -88,13 +88,14 @@ func testAccCheckEmrExists(n string) resource.TestCheckFunc { } } -const testEmrBasic = ` +func testEmrBasic() string { + return fmt.Sprintf(` resource "tencentcloud_emr_cluster" "emrrrr" { product_id=4 display_strategy="clusterList" vpc_settings={ - vpc_id="vpc-i9zty99n" - subnet_id:"subnet-opwnh0sw" + vpc_id="%s" + subnet_id:"%s" } softwares=[ "zookeeper-3.6.1", @@ -133,6 +134,7 @@ resource "tencentcloud_emr_cluster" "emrrrr" { zone="ap-guangzhou-3" project_id=0 } - sg_id="sg-qyy7jd2b" + sg_id="%s" } -` +`, defaultVpcId, defaultSubnetId, defaultEMRSgId) +} diff --git a/tencentcloud/service_tencentcloud_emr.go b/tencentcloud/service_tencentcloud_emr.go index 3a961e04eb..a631d17db6 100644 --- a/tencentcloud/service_tencentcloud_emr.go +++ b/tencentcloud/service_tencentcloud_emr.go @@ -160,6 +160,10 @@ func (me *EMRService) CreateInstance(ctx context.Context, d *schema.ResourceData request.SgId = common.StringPtr(v.(string)) } + if v, ok := d.GetOk("extend_fs_field"); ok { + request.ExtendFsField = common.StringPtr(v.(string)) + } + ratelimit.Check(request.GetAction()) //API: https://cloud.tencent.com/document/api/589/34261 response, err := me.client.UseEmrClient().CreateInstance(request) diff --git a/website/docs/r/emr_cluster.html.markdown b/website/docs/r/emr_cluster.html.markdown index 8dc71500bf..0a163d1d65 100644 --- a/website/docs/r/emr_cluster.html.markdown +++ b/website/docs/r/emr_cluster.html.markdown @@ -73,6 +73,7 @@ The following arguments are supported: When TimeUnit is m, the number filled in by this parameter indicates the length of purchase of the monthly instance of the package year, such as 1 for one month of purchase. * `time_unit` - (Required) The unit of time in which the instance was purchased. When PayMode is 0, TimeUnit can only take values of s(second). When PayMode is 1, TimeUnit can only take the value m(month). * `vpc_settings` - (Required, ForceNew) The private net config of EMR instance. +* `extend_fs_field` - (Optional) Access the external file system. * `need_master_wan` - (Optional, ForceNew) Whether to enable the cluster Master node public network. Value range: - NEED_MASTER_WAN: Indicates that the cluster Master node public network is enabled. - NOT_NEED_MASTER_WAN: Indicates that it is not turned on.