1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. cs
  5. getKubernetesAddons
Alibaba Cloud v3.85.0 published on Tuesday, Sep 9, 2025 by Pulumi

alicloud.cs.getKubernetesAddons

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.85.0 published on Tuesday, Sep 9, 2025 by Pulumi

    This data source provides a list of available addons that the cluster can install.

    NOTE: Available since v1.150.0. NOTE: From version v1.166.0, support for returning custom configuration of kubernetes cluster addon.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    import * as std from "@pulumi/std";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "terraform-example";
    const _default = alicloud.getZones({
        availableResourceCreation: "VSwitch",
    });
    const defaultNetwork = new alicloud.vpc.Network("default", {
        vpcName: name,
        cidrBlock: "10.4.0.0/16",
    });
    const defaultSwitch = new alicloud.vpc.Switch("default", {
        vswitchName: name,
        cidrBlock: "10.4.0.0/24",
        vpcId: defaultNetwork.id,
        zoneId: _default.then(_default => _default.zones?.[0]?.id),
    });
    const defaultManagedKubernetes = new alicloud.cs.ManagedKubernetes("default", {
        namePrefix: name,
        clusterSpec: "ack.pro.small",
        workerVswitchIds: [defaultSwitch.id],
        newNatGateway: false,
        podCidr: std.cidrsubnet({
            input: "10.0.0.0/8",
            newbits: 8,
            netnum: 36,
        }).then(invoke => invoke.result),
        serviceCidr: std.cidrsubnet({
            input: "172.16.0.0/16",
            newbits: 4,
            netnum: 7,
        }).then(invoke => invoke.result),
        slbInternetEnabled: true,
    });
    const defaultGetKubernetesAddons = alicloud.cs.getKubernetesAddonsOutput({
        clusterId: defaultManagedKubernetes.id,
    });
    export const addons = defaultGetKubernetesAddons.apply(defaultGetKubernetesAddons => defaultGetKubernetesAddons.addons);
    
    import pulumi
    import pulumi_alicloud as alicloud
    import pulumi_std as std
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "terraform-example"
    default = alicloud.get_zones(available_resource_creation="VSwitch")
    default_network = alicloud.vpc.Network("default",
        vpc_name=name,
        cidr_block="10.4.0.0/16")
    default_switch = alicloud.vpc.Switch("default",
        vswitch_name=name,
        cidr_block="10.4.0.0/24",
        vpc_id=default_network.id,
        zone_id=default.zones[0].id)
    default_managed_kubernetes = alicloud.cs.ManagedKubernetes("default",
        name_prefix=name,
        cluster_spec="ack.pro.small",
        worker_vswitch_ids=[default_switch.id],
        new_nat_gateway=False,
        pod_cidr=std.cidrsubnet(input="10.0.0.0/8",
            newbits=8,
            netnum=36).result,
        service_cidr=std.cidrsubnet(input="172.16.0.0/16",
            newbits=4,
            netnum=7).result,
        slb_internet_enabled=True)
    default_get_kubernetes_addons = alicloud.cs.get_kubernetes_addons_output(cluster_id=default_managed_kubernetes.id)
    pulumi.export("addons", default_get_kubernetes_addons.addons)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/cs"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
    	"github.com/pulumi/pulumi-std/sdk/go/std"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "terraform-example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		_default, err := alicloud.GetZones(ctx, &alicloud.GetZonesArgs{
    			AvailableResourceCreation: pulumi.StringRef("VSwitch"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		defaultNetwork, err := vpc.NewNetwork(ctx, "default", &vpc.NetworkArgs{
    			VpcName:   pulumi.String(name),
    			CidrBlock: pulumi.String("10.4.0.0/16"),
    		})
    		if err != nil {
    			return err
    		}
    		defaultSwitch, err := vpc.NewSwitch(ctx, "default", &vpc.SwitchArgs{
    			VswitchName: pulumi.String(name),
    			CidrBlock:   pulumi.String("10.4.0.0/24"),
    			VpcId:       defaultNetwork.ID(),
    			ZoneId:      pulumi.String(_default.Zones[0].Id),
    		})
    		if err != nil {
    			return err
    		}
    		invokeCidrsubnet, err := std.Cidrsubnet(ctx, &std.CidrsubnetArgs{
    			Input:   "10.0.0.0/8",
    			Newbits: 8,
    			Netnum:  36,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		invokeCidrsubnet1, err := std.Cidrsubnet(ctx, &std.CidrsubnetArgs{
    			Input:   "172.16.0.0/16",
    			Newbits: 4,
    			Netnum:  7,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		defaultManagedKubernetes, err := cs.NewManagedKubernetes(ctx, "default", &cs.ManagedKubernetesArgs{
    			NamePrefix:  pulumi.String(name),
    			ClusterSpec: pulumi.String("ack.pro.small"),
    			WorkerVswitchIds: pulumi.StringArray{
    				defaultSwitch.ID(),
    			},
    			NewNatGateway:      pulumi.Bool(false),
    			PodCidr:            pulumi.String(invokeCidrsubnet.Result),
    			ServiceCidr:        pulumi.String(invokeCidrsubnet1.Result),
    			SlbInternetEnabled: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		defaultGetKubernetesAddons := cs.GetKubernetesAddonsOutput(ctx, cs.GetKubernetesAddonsOutputArgs{
    			ClusterId: defaultManagedKubernetes.ID(),
    		}, nil)
    		ctx.Export("addons", defaultGetKubernetesAddons.ApplyT(func(defaultGetKubernetesAddons cs.GetKubernetesAddonsResult) ([]cs.GetKubernetesAddonsAddon, error) {
    			return []cs.GetKubernetesAddonsAddon(defaultGetKubernetesAddons.Addons), nil
    		}).([]cs.GetKubernetesAddonsAddonOutput))
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    using Std = Pulumi.Std;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "terraform-example";
        var @default = AliCloud.GetZones.Invoke(new()
        {
            AvailableResourceCreation = "VSwitch",
        });
    
        var defaultNetwork = new AliCloud.Vpc.Network("default", new()
        {
            VpcName = name,
            CidrBlock = "10.4.0.0/16",
        });
    
        var defaultSwitch = new AliCloud.Vpc.Switch("default", new()
        {
            VswitchName = name,
            CidrBlock = "10.4.0.0/24",
            VpcId = defaultNetwork.Id,
            ZoneId = @default.Apply(@default => @default.Apply(getZonesResult => getZonesResult.Zones[0]?.Id)),
        });
    
        var defaultManagedKubernetes = new AliCloud.CS.ManagedKubernetes("default", new()
        {
            NamePrefix = name,
            ClusterSpec = "ack.pro.small",
            WorkerVswitchIds = new[]
            {
                defaultSwitch.Id,
            },
            NewNatGateway = false,
            PodCidr = Std.Cidrsubnet.Invoke(new()
            {
                Input = "10.0.0.0/8",
                Newbits = 8,
                Netnum = 36,
            }).Apply(invoke => invoke.Result),
            ServiceCidr = Std.Cidrsubnet.Invoke(new()
            {
                Input = "172.16.0.0/16",
                Newbits = 4,
                Netnum = 7,
            }).Apply(invoke => invoke.Result),
            SlbInternetEnabled = true,
        });
    
        var defaultGetKubernetesAddons = AliCloud.CS.GetKubernetesAddons.Invoke(new()
        {
            ClusterId = defaultManagedKubernetes.Id,
        });
    
        return new Dictionary<string, object?>
        {
            ["addons"] = defaultGetKubernetesAddons.Apply(getKubernetesAddonsResult => getKubernetesAddonsResult.Addons),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.AlicloudFunctions;
    import com.pulumi.alicloud.inputs.GetZonesArgs;
    import com.pulumi.alicloud.vpc.Network;
    import com.pulumi.alicloud.vpc.NetworkArgs;
    import com.pulumi.alicloud.vpc.Switch;
    import com.pulumi.alicloud.vpc.SwitchArgs;
    import com.pulumi.alicloud.cs.ManagedKubernetes;
    import com.pulumi.alicloud.cs.ManagedKubernetesArgs;
    import com.pulumi.std.StdFunctions;
    import com.pulumi.std.inputs.CidrsubnetArgs;
    import com.pulumi.alicloud.cs.CsFunctions;
    import com.pulumi.alicloud.cs.inputs.GetKubernetesAddonsArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var config = ctx.config();
            final var name = config.get("name").orElse("terraform-example");
            final var default = AlicloudFunctions.getZones(GetZonesArgs.builder()
                .availableResourceCreation("VSwitch")
                .build());
    
            var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
                .vpcName(name)
                .cidrBlock("10.4.0.0/16")
                .build());
    
            var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()
                .vswitchName(name)
                .cidrBlock("10.4.0.0/24")
                .vpcId(defaultNetwork.id())
                .zoneId(default_.zones()[0].id())
                .build());
    
            var defaultManagedKubernetes = new ManagedKubernetes("defaultManagedKubernetes", ManagedKubernetesArgs.builder()
                .namePrefix(name)
                .clusterSpec("ack.pro.small")
                .workerVswitchIds(defaultSwitch.id())
                .newNatGateway(false)
                .podCidr(StdFunctions.cidrsubnet(CidrsubnetArgs.builder()
                    .input("10.0.0.0/8")
                    .newbits(8)
                    .netnum(36)
                    .build()).result())
                .serviceCidr(StdFunctions.cidrsubnet(CidrsubnetArgs.builder()
                    .input("172.16.0.0/16")
                    .newbits(4)
                    .netnum(7)
                    .build()).result())
                .slbInternetEnabled(true)
                .build());
    
            final var defaultGetKubernetesAddons = CsFunctions.getKubernetesAddons(GetKubernetesAddonsArgs.builder()
                .clusterId(defaultManagedKubernetes.id())
                .build());
    
            ctx.export("addons", defaultGetKubernetesAddons.applyValue(_defaultGetKubernetesAddons -> _defaultGetKubernetesAddons.addons()));
        }
    }
    
    configuration:
      name:
        type: string
        default: terraform-example
    resources:
      defaultNetwork:
        type: alicloud:vpc:Network
        name: default
        properties:
          vpcName: ${name}
          cidrBlock: 10.4.0.0/16
      defaultSwitch:
        type: alicloud:vpc:Switch
        name: default
        properties:
          vswitchName: ${name}
          cidrBlock: 10.4.0.0/24
          vpcId: ${defaultNetwork.id}
          zoneId: ${default.zones[0].id}
      defaultManagedKubernetes:
        type: alicloud:cs:ManagedKubernetes
        name: default
        properties:
          namePrefix: ${name}
          clusterSpec: ack.pro.small
          workerVswitchIds:
            - ${defaultSwitch.id}
          newNatGateway: false
          podCidr:
            fn::invoke:
              function: std:cidrsubnet
              arguments:
                input: 10.0.0.0/8
                newbits: 8
                netnum: 36
              return: result
          serviceCidr:
            fn::invoke:
              function: std:cidrsubnet
              arguments:
                input: 172.16.0.0/16
                newbits: 4
                netnum: 7
              return: result
          slbInternetEnabled: true
    variables:
      default:
        fn::invoke:
          function: alicloud:getZones
          arguments:
            availableResourceCreation: VSwitch
      defaultGetKubernetesAddons:
        fn::invoke:
          function: alicloud:cs:getKubernetesAddons
          arguments:
            clusterId: ${defaultManagedKubernetes.id}
    outputs:
      addons: ${defaultGetKubernetesAddons.addons}
    

    Using getKubernetesAddons

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getKubernetesAddons(args: GetKubernetesAddonsArgs, opts?: InvokeOptions): Promise<GetKubernetesAddonsResult>
    function getKubernetesAddonsOutput(args: GetKubernetesAddonsOutputArgs, opts?: InvokeOptions): Output<GetKubernetesAddonsResult>
    def get_kubernetes_addons(cluster_id: Optional[str] = None,
                              ids: Optional[Sequence[str]] = None,
                              name_regex: Optional[str] = None,
                              opts: Optional[InvokeOptions] = None) -> GetKubernetesAddonsResult
    def get_kubernetes_addons_output(cluster_id: Optional[pulumi.Input[str]] = None,
                              ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                              name_regex: Optional[pulumi.Input[str]] = None,
                              opts: Optional[InvokeOptions] = None) -> Output[GetKubernetesAddonsResult]
    func GetKubernetesAddons(ctx *Context, args *GetKubernetesAddonsArgs, opts ...InvokeOption) (*GetKubernetesAddonsResult, error)
    func GetKubernetesAddonsOutput(ctx *Context, args *GetKubernetesAddonsOutputArgs, opts ...InvokeOption) GetKubernetesAddonsResultOutput

    > Note: This function is named GetKubernetesAddons in the Go SDK.

    public static class GetKubernetesAddons 
    {
        public static Task<GetKubernetesAddonsResult> InvokeAsync(GetKubernetesAddonsArgs args, InvokeOptions? opts = null)
        public static Output<GetKubernetesAddonsResult> Invoke(GetKubernetesAddonsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetKubernetesAddonsResult> getKubernetesAddons(GetKubernetesAddonsArgs args, InvokeOptions options)
    public static Output<GetKubernetesAddonsResult> getKubernetesAddons(GetKubernetesAddonsArgs args, InvokeOptions options)
    
    fn::invoke:
      function: alicloud:cs/getKubernetesAddons:getKubernetesAddons
      arguments:
        # arguments dictionary

    The following arguments are supported:

    ClusterId string
    The id of kubernetes cluster.
    Ids List<string>
    A list of addon IDs. The id of addon consists of the cluster id and the addon name, with the structure <cluster_ud>:<addon_name>.
    NameRegex string
    A regex string to filter results by addon name.
    ClusterId string
    The id of kubernetes cluster.
    Ids []string
    A list of addon IDs. The id of addon consists of the cluster id and the addon name, with the structure <cluster_ud>:<addon_name>.
    NameRegex string
    A regex string to filter results by addon name.
    clusterId String
    The id of kubernetes cluster.
    ids List<String>
    A list of addon IDs. The id of addon consists of the cluster id and the addon name, with the structure <cluster_ud>:<addon_name>.
    nameRegex String
    A regex string to filter results by addon name.
    clusterId string
    The id of kubernetes cluster.
    ids string[]
    A list of addon IDs. The id of addon consists of the cluster id and the addon name, with the structure <cluster_ud>:<addon_name>.
    nameRegex string
    A regex string to filter results by addon name.
    cluster_id str
    The id of kubernetes cluster.
    ids Sequence[str]
    A list of addon IDs. The id of addon consists of the cluster id and the addon name, with the structure <cluster_ud>:<addon_name>.
    name_regex str
    A regex string to filter results by addon name.
    clusterId String
    The id of kubernetes cluster.
    ids List<String>
    A list of addon IDs. The id of addon consists of the cluster id and the addon name, with the structure <cluster_ud>:<addon_name>.
    nameRegex String
    A regex string to filter results by addon name.

    getKubernetesAddons Result

    The following output properties are available:

    Addons List<Pulumi.AliCloud.CS.Outputs.GetKubernetesAddonsAddon>
    A list of addons.
    ClusterId string
    The id of kubernetes cluster.
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    Names List<string>
    A list of addon names.
    NameRegex string
    Addons []GetKubernetesAddonsAddon
    A list of addons.
    ClusterId string
    The id of kubernetes cluster.
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    Names []string
    A list of addon names.
    NameRegex string
    addons List<GetKubernetesAddonsAddon>
    A list of addons.
    clusterId String
    The id of kubernetes cluster.
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    names List<String>
    A list of addon names.
    nameRegex String
    addons GetKubernetesAddonsAddon[]
    A list of addons.
    clusterId string
    The id of kubernetes cluster.
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    names string[]
    A list of addon names.
    nameRegex string
    addons Sequence[GetKubernetesAddonsAddon]
    A list of addons.
    cluster_id str
    The id of kubernetes cluster.
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    names Sequence[str]
    A list of addon names.
    name_regex str
    addons List<Property Map>
    A list of addons.
    clusterId String
    The id of kubernetes cluster.
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    names List<String>
    A list of addon names.
    nameRegex String

    Supporting Types

    GetKubernetesAddonsAddon

    CurrentConfig string
    The current custom configuration of the addon. Note: Available in v1.166.0+
    CurrentVersion string
    The current version of addon, if this field is an empty string, it means that the addon is not installed.
    Name string
    The name of addon.
    NextVersion string
    The next version of this addon can be upgraded to.
    Required bool
    Whether the addon is a system addon.
    CurrentConfig string
    The current custom configuration of the addon. Note: Available in v1.166.0+
    CurrentVersion string
    The current version of addon, if this field is an empty string, it means that the addon is not installed.
    Name string
    The name of addon.
    NextVersion string
    The next version of this addon can be upgraded to.
    Required bool
    Whether the addon is a system addon.
    currentConfig String
    The current custom configuration of the addon. Note: Available in v1.166.0+
    currentVersion String
    The current version of addon, if this field is an empty string, it means that the addon is not installed.
    name String
    The name of addon.
    nextVersion String
    The next version of this addon can be upgraded to.
    required Boolean
    Whether the addon is a system addon.
    currentConfig string
    The current custom configuration of the addon. Note: Available in v1.166.0+
    currentVersion string
    The current version of addon, if this field is an empty string, it means that the addon is not installed.
    name string
    The name of addon.
    nextVersion string
    The next version of this addon can be upgraded to.
    required boolean
    Whether the addon is a system addon.
    current_config str
    The current custom configuration of the addon. Note: Available in v1.166.0+
    current_version str
    The current version of addon, if this field is an empty string, it means that the addon is not installed.
    name str
    The name of addon.
    next_version str
    The next version of this addon can be upgraded to.
    required bool
    Whether the addon is a system addon.
    currentConfig String
    The current custom configuration of the addon. Note: Available in v1.166.0+
    currentVersion String
    The current version of addon, if this field is an empty string, it means that the addon is not installed.
    name String
    The name of addon.
    nextVersion String
    The next version of this addon can be upgraded to.
    required Boolean
    Whether the addon is a system addon.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.85.0 published on Tuesday, Sep 9, 2025 by Pulumi