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
3 changes: 3 additions & 0 deletions .changelog/3595.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:new-datasource
tencentcloud_kubernetes_addons
```
1 change: 1 addition & 0 deletions tencentcloud/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@ func Provider() *schema.Provider {
"tencentcloud_eks_cluster_credential": tke.DataSourceTencentCloudEksClusterCredential(),
"tencentcloud_container_clusters": tke.DataSourceTencentCloudContainerClusters(),
"tencentcloud_container_cluster_instances": tke.DataSourceTencentCloudContainerClusterInstances(),
"tencentcloud_kubernetes_addons": tke.DataSourceTencentCloudKubernetesAddons(),
"tencentcloud_mysql_backup_list": cdb.DataSourceTencentCloudMysqlBackupList(),
"tencentcloud_mysql_zone_config": cdb.DataSourceTencentCloudMysqlZoneConfig(),
"tencentcloud_mysql_parameter_list": cdb.DataSourceTencentCloudMysqlParameterList(),
Expand Down
1 change: 1 addition & 0 deletions tencentcloud/provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,7 @@ tencentcloud_kubernetes_cluster_node_pools
tencentcloud_kubernetes_cluster_instances
tencentcloud_kubernetes_cluster_node_pools
tencentcloud_kubernetes_cluster_native_node_pools
tencentcloud_kubernetes_addons

Resource
tencentcloud_kubernetes_cluster
Expand Down
152 changes: 152 additions & 0 deletions tencentcloud/services/tke/data_source_tc_kubernetes_addons.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions tencentcloud/services/tke/data_source_tc_kubernetes_addons.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Use this data source to query detailed information of kubernetes addons.

Example Usage

```hcl
data "tencentcloud_kubernetes_addons" "kubernetes_addons" {
cluster_id = "cls-12345678"
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package tke
35 changes: 35 additions & 0 deletions tencentcloud/services/tke/data_source_tc_kubernetes_addons_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package tke_test

import (
"testing"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest"
)

func TestAccTencentCloudKubernetesAddonsDataSource_basic(t *testing.T) {
t.Parallel()
resource.Test(t, resource.TestCase{
PreCheck: func() {
tcacctest.AccPreCheck(t)
},
Providers: tcacctest.AccProviders,
Steps: []resource.TestStep{
{
Config: testAccKubernetesAddonDataSource,
Check: resource.ComposeTestCheckFunc(
tcacctest.AccCheckTencentCloudDataSourceID("data.tencentcloud_kubernetes_addons.kubernetes_addon"),
resource.TestCheckResourceAttrSet("data.tencentcloud_kubernetes_addons.kubernetes_addon", "id"),
resource.TestCheckResourceAttr("data.tencentcloud_kubernetes_addons.kubernetes_addon", "addons.#", "8"),
),
},
},
})
}

const testAccKubernetesAddonDataSource = `

data "tencentcloud_kubernetes_addons" "kubernetes_addon" {
cluster_id = "cls-fdy7hm1q"
}
`
5 changes: 4 additions & 1 deletion tencentcloud/services/tke/service_tencentcloud_tke_addons.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,13 @@ func (me *TkeService) GetTkeAppChartList(ctx context.Context, request *tke.GetTk
return
}

func (me *TkeService) DescribeAddonList(ctx context.Context, clusterId string) (ret []*tke.Addon, errRet error) {
func (me *TkeService) DescribeAddonList(ctx context.Context, clusterId, addonName string) (ret []*tke.Addon, errRet error) {
request := tke.NewDescribeAddonRequest()
response := tke.NewDescribeAddonResponse()
request.ClusterId = &clusterId
if addonName != "" {
request.AddonName = &addonName
}

err := resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError {
result, e := me.client.UseTkeClient().DescribeAddon(request)
Expand Down
36 changes: 36 additions & 0 deletions website/docs/d/kubernetes_addon.html.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
subcategory: "Tencent Kubernetes Engine(TKE)"
layout: "tencentcloud"
page_title: "TencentCloud: tencentcloud_kubernetes_addon"
sidebar_current: "docs-tencentcloud-datasource-kubernetes_addon"
description: |-
Use this data source to query detailed information of kubernetes addon.
---

# tencentcloud_kubernetes_addon

Use this data source to query detailed information of kubernetes addon.

## Example Usage

```hcl
data "tencentcloud_kubernetes_addon" "kubernetes_addon" {
cluster_id = "cls-12345678"
}
```

## Argument Reference

The following arguments are supported:

* `cluster_id` - (Required, String) Cluster ID.
* `addon_name` - (Optional, String) Add-on name (all add-ons in the cluster are returned if this parameter is not specified).
* `result_output_file` - (Optional, String) Used to save results.

## Attributes Reference

In addition to all arguments above, the following attributes are exported:

* `addons` - List of add-ons.


44 changes: 44 additions & 0 deletions website/docs/d/kubernetes_addons.html.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
subcategory: "Tencent Kubernetes Engine(TKE)"
layout: "tencentcloud"
page_title: "TencentCloud: tencentcloud_kubernetes_addons"
sidebar_current: "docs-tencentcloud-datasource-kubernetes_addons"
description: |-
Use this data source to query detailed information of kubernetes addons.
---

# tencentcloud_kubernetes_addons

Use this data source to query detailed information of kubernetes addons.

## Example Usage

```hcl
data "tencentcloud_kubernetes_addons" "kubernetes_addons" {
cluster_id = "cls-12345678"
}
```

## Argument Reference

The following arguments are supported:

* `cluster_id` - (Required, String) Cluster ID.
* `addon_name` - (Optional, String) Add-on name (all add-ons in the cluster are returned if this parameter is not specified).
* `result_output_file` - (Optional, String) Used to save results.

## Attributes Reference

In addition to all arguments above, the following attributes are exported:

* `addons` - List of add-ons.
* `addon_name` - Add-on name.
* `addon_version` - Add-on version.
* `phase` - Add-on status
Note: This field may return `null`, indicating that no valid values can be obtained.
* `raw_values` - Add-on parameters, which are base64-encoded strings in JSON/
Note: This field may return `null`, indicating that no valid values can be obtained.
* `reason` - Reason for add-on failure
Note: This field may return `null`, indicating that no valid values can be obtained.


3 changes: 3 additions & 0 deletions website/tencentcloud.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5089,6 +5089,9 @@
<li>
<a href="#">Data Sources</a>
<ul class="nav nav-auto-expand">
<li>
<a href="/docs/providers/tencentcloud/d/kubernetes_addons.html">tencentcloud_kubernetes_addons</a>
</li>
<li>
<a href="/docs/providers/tencentcloud/d/kubernetes_available_cluster_versions.html">tencentcloud_kubernetes_available_cluster_versions</a>
</li>
Expand Down
Loading