Skip to content

Commit a96f764

Browse files
tongyimingmikatong
andauthored
fix: support root_size and sg_id params (#923)
* fix: support root_size and sg_id params * fix: unit test repeat create sg Co-authored-by: mikatong <[email protected]>
1 parent 3dd3f64 commit a96f764

File tree

6 files changed

+16
-0
lines changed

6 files changed

+16
-0
lines changed

tencentcloud/data_source_tc_emr_nodes_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ resource "tencentcloud_emr_cluster" "emrrrr" {
6565
zone="ap-guangzhou-3"
6666
project_id=0
6767
}
68+
sg_id="sg-qyy7jd2b"
6869
}
6970
data "tencentcloud_emr_nodes" "my_emr_nodes" {
7071
node_flag="master"

tencentcloud/extension_emr.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ func buildResourceSpecSchema() *schema.Schema {
3636
"mem_size": {Type: schema.TypeInt, Optional: true},
3737
"cpu": {Type: schema.TypeInt, Optional: true},
3838
"disk_size": {Type: schema.TypeInt, Optional: true},
39+
"root_size": {Type: schema.TypeInt, Optional: true},
3940
},
4041
},
4142
}

tencentcloud/resource_tc_emr_cluster.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,12 @@ func resourceTencentCloudEmrCluster() *schema.Resource {
187187
- NOT_NEED_MASTER_WAN: Indicates that it is not turned on.
188188
By default, the cluster Master node internet is enabled.`,
189189
},
190+
"sg_id": {
191+
Type: schema.TypeString,
192+
Optional: true,
193+
ForceNew: true,
194+
Description: "The ID of the security group to which the instance belongs, in the form of sg-xxxxxxxx.",
195+
},
190196
},
191197
}
192198
}

tencentcloud/resource_tc_emr_cluster_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ func TestAccTencentCloudEmrClusterResource(t *testing.T) {
3737
resource.TestCheckResourceAttr(testEmrClusterResourceKey, "placement.zone", "ap-guangzhou-3"),
3838
resource.TestCheckResourceAttr(testEmrClusterResourceKey, "placement.project_id", "0"),
3939
resource.TestCheckResourceAttrSet(testEmrClusterResourceKey, "instance_id"),
40+
resource.TestCheckResourceAttr(testEmrClusterResourceKey, "sg_id", "sg-qyy7jd2b"),
4041
),
4142
},
4243
},
@@ -108,6 +109,7 @@ resource "tencentcloud_emr_cluster" "emrrrr" {
108109
disk_type="CLOUD_PREMIUM"
109110
spec="CVM.S2"
110111
storage_type=5
112+
root_size=50
111113
}
112114
core_resource_spec {
113115
mem_size=8192
@@ -116,6 +118,7 @@ resource "tencentcloud_emr_cluster" "emrrrr" {
116118
disk_type="CLOUD_PREMIUM"
117119
spec="CVM.S2"
118120
storage_type=5
121+
root_size=50
119122
}
120123
master_count=1
121124
core_count=2
@@ -130,5 +133,6 @@ resource "tencentcloud_emr_cluster" "emrrrr" {
130133
zone="ap-guangzhou-3"
131134
project_id=0
132135
}
136+
sg_id="sg-qyy7jd2b"
133137
}
134138
`

tencentcloud/service_tencentcloud_emr.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,9 @@ func (me *EMRService) CreateInstance(ctx context.Context, d *schema.ResourceData
156156
request.LoginSettings.PublicKeyId = common.StringPtr(publicKeyId.(string))
157157
}
158158
}
159+
if v, ok := d.GetOk("sg_id"); ok {
160+
request.SgId = common.StringPtr(v.(string))
161+
}
159162

160163
ratelimit.Check(request.GetAction())
161164
//API: https://cloud.tencent.com/document/api/589/34261

website/docs/r/emr_cluster.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ When TimeUnit is m, the number filled in by this parameter indicates the length
7878
- NOT_NEED_MASTER_WAN: Indicates that it is not turned on.
7979
By default, the cluster Master node internet is enabled.
8080
* `resource_spec` - (Optional) Resource specification of EMR instance.
81+
* `sg_id` - (Optional, ForceNew) The ID of the security group to which the instance belongs, in the form of sg-xxxxxxxx.
8182

8283
The `resource_spec` object supports the following:
8384

0 commit comments

Comments
 (0)