Skip to content

Commit babf5fe

Browse files
committed
add
1 parent 655e0a1 commit babf5fe

File tree

6 files changed

+52
-14
lines changed

6 files changed

+52
-14
lines changed

tencentcloud/services/wedata/resource_tc_wedata_code_folder.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ func ResourceTencentCloudWedataCodeFolder() *schema.Resource {
6262
Computed: true,
6363
Description: "Type. folder, script.",
6464
},
65+
66+
"path": {
67+
Type: schema.TypeString,
68+
Computed: true,
69+
Description: "Node path.",
70+
},
6571
},
6672
}
6773
}
@@ -177,6 +183,10 @@ func resourceTencentCloudWedataCodeFolderRead(d *schema.ResourceData, meta inter
177183
_ = d.Set("type", *respData.Type)
178184
}
179185

186+
if respData.Path != nil {
187+
_ = d.Set("path", *respData.Path)
188+
}
189+
180190
return nil
181191
}
182192

tencentcloud/services/wedata/resource_tc_wedata_code_folder.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ resource "tencentcloud_wedata_code_folder" "example" {
88
folder_name = "tf_example"
99
parent_folder_path = "/"
1010
}
11+
12+
resource "tencentcloud_wedata_code_file" "example" {
13+
project_id = "2983848457986924544"
14+
code_file_name = "tf_example_code_file"
15+
parent_folder_path = tencentcloud_wedata_code_folder.example.path
16+
code_file_content = "Hello Terraform"
17+
}
1118
```
1219

1320
Import

tencentcloud/services/wedata/resource_tc_wedata_run_sql_script_operation.go

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"fmt"
66
"log"
7-
"strings"
87

98
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
109
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
@@ -63,22 +62,19 @@ func resourceTencentCloudWedataRunSqlScriptOperationCreate(d *schema.ResourceDat
6362
defer tccommon.InconsistentCheck(d, meta)()
6463

6564
var (
66-
logId = tccommon.GetLogId(tccommon.ContextNil)
67-
ctx = tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta)
68-
request = wedatav20250806.NewRunSQLScriptRequest()
69-
response = wedatav20250806.NewRunSQLScriptResponse()
70-
projectId string
71-
scriptId string
65+
logId = tccommon.GetLogId(tccommon.ContextNil)
66+
ctx = tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta)
67+
request = wedatav20250806.NewRunSQLScriptRequest()
68+
response = wedatav20250806.NewRunSQLScriptResponse()
69+
jobId string
7270
)
7371

7472
if v, ok := d.GetOk("script_id"); ok {
7573
request.ScriptId = helper.String(v.(string))
76-
scriptId = v.(string)
7774
}
7875

7976
if v, ok := d.GetOk("project_id"); ok {
8077
request.ProjectId = helper.String(v.(string))
81-
projectId = v.(string)
8278
}
8379

8480
if v, ok := d.GetOk("script_content"); ok {
@@ -110,11 +106,14 @@ func resourceTencentCloudWedataRunSqlScriptOperationCreate(d *schema.ResourceDat
110106
return reqErr
111107
}
112108

113-
if response.Response.Data.JobId != nil {
114-
_ = d.Set("job_id", *response.Response.Data.JobId)
109+
if response.Response.Data.JobId == nil {
110+
return fmt.Errorf("JobId is nil")
115111
}
116112

117-
d.SetId(strings.Join([]string{projectId, scriptId}, tccommon.FILED_SP))
113+
jobId = *response.Response.Data.JobId
114+
_ = d.Set("job_id", jobId)
115+
116+
d.SetId(jobId)
118117
return resourceTencentCloudWedataRunSqlScriptOperationRead(d, meta)
119118
}
120119

tencentcloud/services/wedata/resource_tc_wedata_sql_script.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,17 @@ Provides a resource to create a WeData sql script
33
Example Usage
44

55
```hcl
6+
resource "tencentcloud_wedata_sql_folder" "example" {
7+
folder_name = "tf_example"
8+
project_id = "2983848457986924544"
9+
parent_folder_path = "/"
10+
access_scope = "SHARED"
11+
}
12+
613
resource "tencentcloud_wedata_sql_script" "example" {
714
script_name = "tf_example_script"
815
project_id = "2983848457986924544"
9-
parent_folder_path = "/tf_example"
16+
parent_folder_path = tencentcloud_wedata_sql_folder.example.path
1017
script_config {
1118
datasource_id = "108826"
1219
compute_resource = "svmgao_stability"

website/docs/r/wedata_code_folder.html.markdown

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ resource "tencentcloud_wedata_code_folder" "example" {
1919
folder_name = "tf_example"
2020
parent_folder_path = "/"
2121
}
22+
23+
resource "tencentcloud_wedata_code_file" "example" {
24+
project_id = "2983848457986924544"
25+
code_file_name = "tf_example_code_file"
26+
parent_folder_path = tencentcloud_wedata_code_folder.example.path
27+
code_file_content = "Hello Terraform"
28+
}
2229
```
2330

2431
## Argument Reference
@@ -36,6 +43,7 @@ In addition to all arguments above, the following attributes are exported:
3643
* `id` - ID of the resource.
3744
* `access_scope` - Permission range: SHARED, PRIVATE.
3845
* `folder_id` - Folder ID.
46+
* `path` - Node path.
3947
* `type` - Type. folder, script.
4048

4149

website/docs/r/wedata_sql_script.html.markdown

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,17 @@ Provides a resource to create a WeData sql script
1414
## Example Usage
1515

1616
```hcl
17+
resource "tencentcloud_wedata_sql_folder" "example" {
18+
folder_name = "tf_example"
19+
project_id = "2983848457986924544"
20+
parent_folder_path = "/"
21+
access_scope = "SHARED"
22+
}
23+
1724
resource "tencentcloud_wedata_sql_script" "example" {
1825
script_name = "tf_example_script"
1926
project_id = "2983848457986924544"
20-
parent_folder_path = "/tf_example"
27+
parent_folder_path = tencentcloud_wedata_sql_folder.example.path
2128
script_config {
2229
datasource_id = "108826"
2330
compute_resource = "svmgao_stability"

0 commit comments

Comments
 (0)