Skip to content

Commit e16c8e8

Browse files
committed
add
1 parent ac20628 commit e16c8e8

24 files changed

+12188
-3144
lines changed

.changelog/2791.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
resource/tencentcloud_kubernetes_node_pool: support `instance_name_style` param
3+
```

.changelog/2792.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
```release-note:new-resource
2+
tencentcloud_organization_service_assign
3+
```
4+
5+
```release-note:new-data-source
6+
tencentcloud_organization_services
7+
```

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ require (
4646
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.984
4747
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit v1.0.544
4848
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.970
49-
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.984
49+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.991
5050
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.960
5151
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cwp v1.0.762
5252
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cynosdb v1.0.692
@@ -69,7 +69,7 @@ require (
6969
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/mongodb v1.0.949
7070
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/monitor v1.0.844
7171
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/mps v1.0.853
72-
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/organization v1.0.910
72+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/organization v1.0.991
7373
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/postgres v1.0.873
7474
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/privatedns v1.0.859
7575
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/pts v1.0.762

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -980,6 +980,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.978 h1:3pid
980980
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.978/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
981981
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.984 h1:QLSx+ibsV68NXKgzofPuo1gxFwYSWk2++rvxZxNjbVo=
982982
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.984/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
983+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.991 h1:0Xg2IUktDgGsjBv82WTmTQdHZFRwS2XDUnuOHexCxVw=
984+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.991/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
983985
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/csip v1.0.860 h1:F3esKBIT3HW9+7Gt8cVgf8X06VdGIczpgLBUECzSEzU=
984986
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/csip v1.0.860/go.mod h1:NZo1WplQcC314kMlCRUoy8NQju2BnolIJj7NAWgsuhY=
985987
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.624 h1:nEZqsoqt1pEoaP9JjkHQy3/H00suCfzlHW1qOm2nYD8=
@@ -1048,6 +1050,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/organization v1.0.856 h
10481050
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/organization v1.0.856/go.mod h1:Ln9igPci1mCEe4gzekGpMMn/x9im6XlDh2bqvWnUMDo=
10491051
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/organization v1.0.910 h1:KQJSiP2zV2VP4brIqSGGvx/3uoJ2Y3X5S5RsqjR77Ag=
10501052
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/organization v1.0.910/go.mod h1:9cT5rPLn6J+M5Gt5eS6NrgJnqsAcQjimu4JMS76UORQ=
1053+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/organization v1.0.991 h1:udOXXxVAf2If4uvM6pot/K3iH67nUctaIqmt0QKarhM=
1054+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/organization v1.0.991/go.mod h1:1QZV9ZlcmYEVz/kA5jj8jHDjQsEKbT13WJBywZzaX2U=
10511055
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/postgres v1.0.873 h1:kqNFHpILFWPbOUAUrH1i6+IfkLWWEAZLYfj9RZ0WM+0=
10521056
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/postgres v1.0.873/go.mod h1:Mjkr/911Pw0VopTfXt5zt46TnV3IrX01mvjZ66RsRRg=
10531057
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/privatedns v1.0.859 h1:VrE3qzwzWB5mV/ejTJuwZbqZ/CNYLoc8X+uFbWEEOnY=

tencentcloud/provider.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,6 +1068,7 @@ func Provider() *schema.Provider {
10681068
"tencentcloud_organization_org_financial_by_product": tco.DataSourceTencentCloudOrganizationOrgFinancialByProduct(),
10691069
"tencentcloud_organization_org_auth_node": tco.DataSourceTencentCloudOrganizationOrgAuthNode(),
10701070
"tencentcloud_organization_members": tco.DataSourceTencentCloudOrganizationMembers(),
1071+
"tencentcloud_organization_services": tco.DataSourceTencentCloudOrganizationServices(),
10711072
"tencentcloud_pts_scenario_with_jobs": pts.DataSourceTencentCloudPtsScenarioWithJobs(),
10721073
"tencentcloud_cam_list_attached_user_policy": cam.DataSourceTencentCloudCamListAttachedUserPolicy(),
10731074
"tencentcloud_cam_secret_last_used_time": cam.DataSourceTencentCloudCamSecretLastUsedTime(),
@@ -1783,6 +1784,7 @@ func Provider() *schema.Provider {
17831784
"tencentcloud_organization_org_manage_policy_config": tco.ResourceTencentCloudOrganizationOrgManagePolicyConfig(),
17841785
"tencentcloud_organization_org_manage_policy": tco.ResourceTencentCloudOrganizationOrgManagePolicy(),
17851786
"tencentcloud_organization_org_manage_policy_target": tco.ResourceTencentCloudOrganizationOrgManagePolicyTarget(),
1787+
"tencentcloud_organization_service_assign": tco.ResourceTencentCloudOrganizationServiceAssign(),
17861788
"tencentcloud_dbbrain_sql_filter": dbbrain.ResourceTencentCloudDbbrainSqlFilter(),
17871789
"tencentcloud_dbbrain_security_audit_log_export_task": dbbrain.ResourceTencentCloudDbbrainSecurityAuditLogExportTask(),
17881790
"tencentcloud_dbbrain_db_diag_report_task": dbbrain.ResourceTencentCloudDbbrainDbDiagReportTask(),

tencentcloud/provider.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1658,6 +1658,7 @@ Tencent Cloud Organization (TCO)
16581658
tencentcloud_organization_org_financial_by_month
16591659
tencentcloud_organization_org_financial_by_product
16601660
tencentcloud_organization_org_share_area
1661+
tencentcloud_organization_services
16611662
Resource
16621663
tencentcloud_organization_instance
16631664
tencentcloud_organization_org_node
@@ -1673,6 +1674,7 @@ Tencent Cloud Organization (TCO)
16731674
tencentcloud_organization_quit_organization_operation
16741675
tencentcloud_organization_org_share_unit
16751676
tencentcloud_organization_org_share_unit_member
1677+
tencentcloud_organization_service_assign
16761678

16771679
TDSQL-C for PostgreSQL(TDCPG)
16781680
Data Source
Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
package tco
2+
3+
import (
4+
"context"
5+
"strconv"
6+
7+
tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common"
8+
9+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
10+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
11+
organization "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/organization/v20210331"
12+
13+
"github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper"
14+
)
15+
16+
func DataSourceTencentCloudOrganizationServices() *schema.Resource {
17+
return &schema.Resource{
18+
Read: dataSourceTencentCloudOrganizationServicesRead,
19+
Schema: map[string]*schema.Schema{
20+
"search_key": {
21+
Optional: true,
22+
Type: schema.TypeString,
23+
Description: "Keyword for search by name.",
24+
},
25+
// computed
26+
"items": {
27+
Computed: true,
28+
Type: schema.TypeList,
29+
Description: "Organization service list.",
30+
Elem: &schema.Resource{
31+
Schema: map[string]*schema.Schema{
32+
"service_id": {
33+
Type: schema.TypeInt,
34+
Computed: true,
35+
Description: "Organization service ID. Note: This field may return null, indicating that no valid values can be obtained.",
36+
},
37+
"product_name": {
38+
Type: schema.TypeString,
39+
Computed: true,
40+
Description: "Organization service product name. Note: This field may return null, indicating that no valid values can be obtained.",
41+
},
42+
"is_assign": {
43+
Type: schema.TypeInt,
44+
Computed: true,
45+
Description: "Whether to support delegation. Valid values: 1 (yes), 2 (no). Note: This field may return null, indicating that no valid values can be obtained.",
46+
},
47+
"description": {
48+
Type: schema.TypeString,
49+
Computed: true,
50+
Description: "Organization service description. Note: This field may return null, indicating that no valid values can be obtained.",
51+
},
52+
"member_num": {
53+
Type: schema.TypeString,
54+
Computed: true,
55+
Description: "Number of the current delegated admins. Note: This field may return null, indicating that no valid values can be obtained.",
56+
},
57+
"document": {
58+
Type: schema.TypeString,
59+
Computed: true,
60+
Description: "Help documentation. Note: This field may return null, indicating that no valid values can be obtained.",
61+
},
62+
"console_url": {
63+
Type: schema.TypeString,
64+
Computed: true,
65+
Description: "Console path of the organization service product. Note: This field may return null, indicating that no valid values can be obtained.",
66+
},
67+
"is_usage_status": {
68+
Type: schema.TypeInt,
69+
Computed: true,
70+
Description: "Whether to access the usage status. Valid values: 1 (yes), 2 (no). Note: This field may return null, indicating that no valid values can be obtained.",
71+
},
72+
"can_assign_count": {
73+
Type: schema.TypeInt,
74+
Computed: true,
75+
Description: "Limit for the number of delegated admins. Note: This field may return null, indicating that no valid values can be obtained.",
76+
},
77+
"product": {
78+
Type: schema.TypeString,
79+
Computed: true,
80+
Description: "Organization service product identifier. Note: This field may return null, indicating that no valid values can be obtained.",
81+
},
82+
"service_grant": {
83+
Type: schema.TypeInt,
84+
Computed: true,
85+
Description: "Whether to support organization service authorization. Valid values: 1 (yes), 2 (no). Note: This field may return null, indicating that no valid values can be obtained.",
86+
},
87+
"grant_status": {
88+
Type: schema.TypeString,
89+
Computed: true,
90+
Description: "Enabling status of organization service authorization. This field is valid when ServiceGrant is 1. Valid values: Enabled, Disabled. Note: This field may return null, indicating that no valid values can be obtained.",
91+
},
92+
"is_set_management_scope": {
93+
Type: schema.TypeInt,
94+
Computed: true,
95+
Description: "Whether to support setting the delegated management scope. Valid values: 1 (yes), 2 (no).\nNote: This field may return null, indicating that no valid values can be obtained.",
96+
},
97+
},
98+
},
99+
},
100+
"result_output_file": {
101+
Type: schema.TypeString,
102+
Optional: true,
103+
Description: "Used to save results.",
104+
},
105+
},
106+
}
107+
}
108+
109+
func dataSourceTencentCloudOrganizationServicesRead(d *schema.ResourceData, meta interface{}) error {
110+
defer tccommon.LogElapsed("data_source.tencentcloud_organization_services.read")()
111+
defer tccommon.InconsistentCheck(d, meta)()
112+
113+
var (
114+
logId = tccommon.GetLogId(tccommon.ContextNil)
115+
ctx = context.WithValue(context.TODO(), tccommon.LogIdKey, logId)
116+
service = OrganizationService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()}
117+
items []*organization.OrganizationServiceAssign
118+
)
119+
120+
paramMap := make(map[string]interface{})
121+
122+
if v, ok := d.GetOk("search_key"); ok {
123+
paramMap["SearchKey"] = helper.String(v.(string))
124+
}
125+
126+
err := resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError {
127+
result, e := service.DescribeOrganizationServicesByFilter(ctx, paramMap)
128+
if e != nil {
129+
return tccommon.RetryError(e)
130+
}
131+
132+
items = result
133+
return nil
134+
})
135+
136+
if err != nil {
137+
return err
138+
}
139+
140+
ids := make([]string, 0, len(items))
141+
tmpList := make([]map[string]interface{}, 0, len(items))
142+
143+
if items != nil {
144+
for _, item := range items {
145+
orgServiceAssignMap := map[string]interface{}{}
146+
147+
if item.ServiceId != nil {
148+
orgServiceAssignMap["service_id"] = item.ServiceId
149+
serviceIdStr := strconv.FormatUint(*item.ServiceId, 10)
150+
ids = append(ids, serviceIdStr)
151+
}
152+
153+
if item.ProductName != nil {
154+
orgServiceAssignMap["product_name"] = item.ProductName
155+
}
156+
157+
if item.IsAssign != nil {
158+
orgServiceAssignMap["is_assign"] = item.IsAssign
159+
}
160+
161+
if item.Description != nil {
162+
orgServiceAssignMap["description"] = item.Description
163+
}
164+
165+
if item.MemberNum != nil {
166+
orgServiceAssignMap["member_num"] = item.MemberNum
167+
}
168+
169+
if item.ConsoleUrl != nil {
170+
orgServiceAssignMap["console_url"] = item.ConsoleUrl
171+
}
172+
173+
if item.IsUsageStatus != nil {
174+
orgServiceAssignMap["is_usage_status"] = item.IsUsageStatus
175+
}
176+
177+
if item.CanAssignCount != nil {
178+
orgServiceAssignMap["can_assign_count"] = item.CanAssignCount
179+
}
180+
181+
if item.Product != nil {
182+
orgServiceAssignMap["product"] = item.Product
183+
}
184+
185+
if item.ServiceGrant != nil {
186+
orgServiceAssignMap["service_grant"] = item.ServiceGrant
187+
}
188+
189+
if item.GrantStatus != nil {
190+
orgServiceAssignMap["grant_status"] = item.GrantStatus
191+
}
192+
193+
if item.IsSetManagementScope != nil {
194+
orgServiceAssignMap["is_set_management_scope"] = item.IsSetManagementScope
195+
}
196+
197+
tmpList = append(tmpList, orgServiceAssignMap)
198+
}
199+
200+
_ = d.Set("items", tmpList)
201+
}
202+
203+
d.SetId(helper.DataResourceIdsHash(ids))
204+
output, ok := d.GetOk("result_output_file")
205+
if ok && output.(string) != "" {
206+
if e := tccommon.WriteToFile(output.(string), tmpList); e != nil {
207+
return e
208+
}
209+
}
210+
211+
return nil
212+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Use this data source to query detailed information of organization services
2+
3+
Example Usage
4+
5+
Query all organization services
6+
7+
```hcl
8+
data "tencentcloud_organization_services" "services" {}
9+
```
10+
11+
Query organization services by filter
12+
13+
```hcl
14+
data "tencentcloud_organization_services" "services" {
15+
search_key = "KeyWord"
16+
}
17+
```
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package tco_test
2+
3+
import (
4+
"testing"
5+
6+
tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest"
7+
8+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
9+
)
10+
11+
// go test -i; go test -test.run TestAccTencentCloudOrganizationServicesDataSource_basic -v
12+
func TestAccTencentCloudOrganizationServicesDataSource_basic(t *testing.T) {
13+
t.Parallel()
14+
resource.Test(t, resource.TestCase{
15+
PreCheck: func() {
16+
tcacctest.AccPreCheck(t)
17+
},
18+
Providers: tcacctest.AccProviders,
19+
Steps: []resource.TestStep{
20+
{
21+
Config: testAccOrganizationServices,
22+
Check: resource.ComposeTestCheckFunc(
23+
tcacctest.AccCheckTencentCloudDataSourceID("data.tencentcloud_organization_services.services"),
24+
),
25+
},
26+
},
27+
})
28+
}
29+
30+
const testAccOrganizationServices = `
31+
data "tencentcloud_organization_services" "services" {}
32+
`

0 commit comments

Comments
 (0)