Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tencentcloud/basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const (

defaultTkeOSImageId = "img-2lr9q49h"
defaultTkeOSImageName = "tlinux2.2(tkernel3)x86_64"
defaultEMRSgId = "sg-qyy7jd2b"
)

// Tke Exclusive Network Environment
Expand Down
8 changes: 8 additions & 0 deletions tencentcloud/resource_tc_emr_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

怎么没看到read方法?

"instance_id": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -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
Expand Down
20 changes: 11 additions & 9 deletions tencentcloud/resource_tc_emr_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand All @@ -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),
),
},
},
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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)
}
4 changes: 4 additions & 0 deletions tencentcloud/service_tencentcloud_emr.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/emr_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down