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
7 changes: 7 additions & 0 deletions tencentcloud/extension_emr.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ const (
DisplayStrategyIsclusterList = "clusterList"
)

const (
EMR_MASTER_WAN_TYPE_NEED_MASTER_WAN = "NEED_MASTER_WAN"
EMR_MASTER_WAN_TYPE_NOT_NEED_MASTER_WAN = "NOT_NEED_MASTER_WAN"
)

var EMR_MASTER_WAN_TYPES = []string{EMR_MASTER_WAN_TYPE_NEED_MASTER_WAN, EMR_MASTER_WAN_TYPE_NOT_NEED_MASTER_WAN}

func buildResourceSpecSchema() *schema.Schema {
return &schema.Schema{
Type: schema.TypeList,
Expand Down
14 changes: 14 additions & 0 deletions tencentcloud/resource_tc_emr_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,17 @@ func resourceTencentCloudEmrCluster() *schema.Resource {
Computed: true,
Description: "Created EMR instance id.",
},
"need_master_wan": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Default: EMR_MASTER_WAN_TYPE_NEED_MASTER_WAN,
ValidateFunc: validateAllowedStringValue(EMR_MASTER_WAN_TYPES),
Description: `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.
By default, the cluster Master node internet is enabled.`,
},
},
}
}
Expand Down Expand Up @@ -307,6 +318,9 @@ func resourceTencentCloudEmrClusterDelete(d *schema.ResourceData, meta interface
if e.GetCode() == "InternalError.ClusterNotFound" {
return nil
}
if e.GetCode() == "UnauthorizedOperation" {
return nil
}
}

if len(clusters) > 0 {
Expand Down
3 changes: 2 additions & 1 deletion tencentcloud/service_tencentcloud_emr.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ func (me *EMRService) CreateInstance(ctx context.Context, d *schema.ResourceData
request.InstanceName = common.StringPtr(v.(string))
}

needMasterWan := d.Get("need_master_wan").(string)
request.NeedMasterWan = common.StringPtr(needMasterWan)
payMode := d.Get("pay_mode")
request.PayMode = common.Uint64Ptr((uint64)(payMode.(int)))
if v, ok := d.GetOk("placement"); ok {
Expand Down Expand Up @@ -186,7 +188,6 @@ func (me *EMRService) DescribeInstances(ctx context.Context, filters map[string]
if v, ok := filters["project_id"]; ok {
request.ProjectId = common.Int64Ptr(v.(int64))
}
request.ProjectId = helper.IntInt64(-1)
response, err := me.client.UseEmrClient().DescribeInstances(request)

if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions website/docs/r/emr_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ 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.
* `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.
By default, the cluster Master node internet is enabled.
* `resource_spec` - (Optional) Resource specification of EMR instance.

The `resource_spec` object supports the following:
Expand Down