1. Packages
  2. Kubernetes
  3. API Docs
  4. yaml
  5. yaml/v2
  6. ConfigGroup
Kubernetes v4.18.4 published on Thursday, Dec 5, 2024 by Pulumi

kubernetes.yaml/v2.ConfigGroup

Explore with Pulumi AI

kubernetes logo
Kubernetes v4.18.4 published on Thursday, Dec 5, 2024 by Pulumi

    ConfigGroup creates a set of Kubernetes resources from Kubernetes YAML text. The YAML text may be supplied using any of the following methods:

    1. Using a filename or a list of filenames:
    2. Using a file pattern or a list of file patterns:
    3. Using a literal string containing YAML, or a list of such strings:
    4. Any combination of files, patterns, or YAML strings:

    Dependency ordering

    Sometimes resources must be applied in a specific order. For example, a namespace resource must be created before any namespaced resources, or a Custom Resource Definition (CRD) must be pre-installed.

    Pulumi uses heuristics to determine which order to apply and delete objects within the ConfigGroup. Pulumi also waits for each object to be fully reconciled, unless skipAwait is enabled.

    Explicit Dependency Ordering

    Pulumi supports the config.kubernetes.io/depends-on annotation to declare an explicit dependency on a given resource. The annotation accepts a list of resource references, delimited by commas.

    Note that references to resources outside the ConfigGroup aren’t supported.

    Resource reference

    A resource reference is a string that uniquely identifies a resource.

    It consists of the group, kind, name, and optionally the namespace, delimited by forward slashes.

    Resource ScopeFormat
    namespace-scoped<group>/namespaces/<namespace>/<kind>/<name>
    cluster-scoped<group>/<kind>/<name>

    For resources in the “core” group, the empty string is used instead (for example: /namespaces/test/Pod/pod-a).

    Ordering across ConfigGroups

    The dependsOn resource option creates a list of explicit dependencies between Pulumi resources. Use it on another resource to make it dependent on the ConfigGroup and to wait for the resources within the group to be deployed.

    A best practice is to deploy each application using its own ConfigGroup, especially when that application installs custom resource definitions.

    Example Usage

    Local File(s)

    using Pulumi;
    using Pulumi.Kubernetes.Types.Inputs.Yaml.V2;
    using Pulumi.Kubernetes.Yaml.V2;
    using System.Collections.Generic;
    
    return await Deployment.RunAsync(() =>
    {
        var example = new ConfigGroup("example", new ConfigGroupArgs
        {
            Files = new[] { "./manifest.yaml" }
        });
    });
    
    package main
    
    import (
    	yamlv2 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/yaml/v2"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := yamlv2.NewConfigGroup(ctx, "example", &yamlv2.ConfigGroupArgs{
    			Files: pulumi.ToStringArray([]string{"manifest.yaml"}),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package myproject;
    
    import com.pulumi.Pulumi;
    import com.pulumi.kubernetes.yaml.v2.ConfigGroup;
    import com.pulumi.kubernetes.yaml.v2.ConfigGroupArgs;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(ctx -> {
                var example = new ConfigGroup("example", ConfigGroupArgs.builder()
                        .files("./manifest.yaml")
                        .build());
            });
        }
    }
    
    import pulumi
    from pulumi_kubernetes.yaml.v2 import ConfigGroup
    
    example = ConfigGroup(
        "example",
        files=["./manifest.yaml"]
    )
    
    import * as pulumi from "@pulumi/pulumi";
    import * as k8s from "@pulumi/kubernetes";
    
    const example = new k8s.yaml.v2.ConfigGroup("example", {
        files: ["./manifest.yaml"],
    });
    
    name: example
    runtime: yaml
    resources:
      example:
        type: kubernetes:yaml/v2:ConfigGroup
        properties:
          files:
          - ./manifest.yaml
    

    Local File Pattern

    using Pulumi;
    using Pulumi.Kubernetes.Types.Inputs.Yaml.V2;
    using Pulumi.Kubernetes.Yaml.V2;
    using System.Collections.Generic;
    
    return await Deployment.RunAsync(() =>
    {
        var example = new ConfigGroup("example", new ConfigGroupArgs
        {
            Files = new[] { "./manifests/*.yaml" }
        });
    });
    
    package main
    
    import (
    	yamlv2 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/yaml/v2"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := yamlv2.NewConfigGroup(ctx, "example", &yamlv2.ConfigGroupArgs{
    			Files: pulumi.ToStringArray([]string{"./manifests/*.yaml"}),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package myproject;
    
    import com.pulumi.Pulumi;
    import com.pulumi.kubernetes.yaml.v2.ConfigGroup;
    import com.pulumi.kubernetes.yaml.v2.ConfigGroupArgs;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(ctx -> {
                var example = new ConfigGroup("example", ConfigGroupArgs.builder()
                        .files("./manifests/*.yaml")
                        .build());
            });
        }
    }
    
    import pulumi
    from pulumi_kubernetes.yaml.v2 import ConfigGroup
    
    example = ConfigGroup(
        "example",
        files=["./manifests/*.yaml"]
    )
    
    import * as pulumi from "@pulumi/pulumi";
    import * as k8s from "@pulumi/kubernetes";
    
    const example = new k8s.yaml.v2.ConfigGroup("example", {
        files: ["./manifests/*.yaml"],
    });
    
    name: example
    runtime: yaml
    resources:
      example:
        type: kubernetes:yaml/v2:ConfigGroup
        properties:
          files:
          - ./manifests/*.yaml
    

    Literal YAML String

    using Pulumi;
    using Pulumi.Kubernetes.Types.Inputs.Yaml.V2;
    using Pulumi.Kubernetes.Yaml.V2;
    using System.Collections.Generic;
    
    return await Deployment.RunAsync(() =>
    {
        var example = new ConfigGroup("example", new ConfigGroupArgs
        {
            Yaml = @"
                apiVersion: v1
                kind: ConfigMap
                metadata:
                  name: my-map
                "
        });
    });
    
    package main
    
    import (
    	yamlv2 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/yaml/v2"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := yamlv2.NewConfigGroup(ctx, "example", &yamlv2.ConfigGroupArgs{
    			Yaml: pulumi.StringPtr(`
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: my-map
    `),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package myproject;
    
    import com.pulumi.Pulumi;
    import com.pulumi.kubernetes.yaml.v2.ConfigGroup;
    import com.pulumi.kubernetes.yaml.v2.ConfigGroupArgs;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(ctx -> {
                var example = new ConfigGroup("example", ConfigGroupArgs.builder()
                        .yaml("""
                            apiVersion: v1
                            kind: ConfigMap
                            metadata:
                              name: my-map
                            """
                        )
                        .build());
            });
        }
    }
    
    import pulumi
    from pulumi_kubernetes.yaml.v2 import ConfigGroup
    
    example = ConfigGroup(
        "example",
        yaml="""
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: my-map
    """
    )
    
    import * as pulumi from "@pulumi/pulumi";
    import * as k8s from "@pulumi/kubernetes";
    
    const example = new k8s.yaml.v2.ConfigGroup("example", {
        yaml: `
        apiVersion: v1
        kind: ConfigMap
        metadata:
          name: my-map
        `
    });
    
    name: example
    runtime: yaml
    resources:
      example:
        type: kubernetes:yaml/v2:ConfigGroup
        properties:
          yaml: |
            apiVersion: v1
            kind: ConfigMap
            metadata:
              name: my-map        
    

    Literal Object

    using Pulumi;
    using Pulumi.Kubernetes.Types.Inputs.Yaml.V2;
    using Pulumi.Kubernetes.Yaml.V2;
    using System.Collections.Generic;
    
    return await Deployment.RunAsync(() =>
    {
        var example = new ConfigGroup("example", new ConfigGroupArgs
        {
            Objs = new[]
            {
                new Dictionary<string, object>
                {
                    ["apiVersion"] = "v1",
                    ["kind"] = "ConfigMap",
                    ["metadata"] = new Dictionary<string, object>
                    {
                        ["name"] = "my-map",
                    },
                },
            },
        });
    });
    
    package main
    
    import (
    	yamlv2 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/yaml/v2"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := yamlv2.NewConfigGroup(ctx, "example", &yamlv2.ConfigGroupArgs{
    			Objs: pulumi.Array{
    				pulumi.Map{
    					"apiVersion": pulumi.String("v1"),
    					"kind":       pulumi.String("ConfigMap"),
    					"metadata": pulumi.Map{
    						"name": pulumi.String("my-map"),
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package myproject;
    
    import java.util.Map;
    
    import com.pulumi.Pulumi;
    import com.pulumi.kubernetes.yaml.v2.ConfigGroup;
    import com.pulumi.kubernetes.yaml.v2.ConfigGroupArgs;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(ctx -> {
                var example = new ConfigGroup("example", ConfigGroupArgs.builder()
                        .objs(Map.ofEntries(
                            Map.entry("apiVersion", "v1"),
                            Map.entry("kind", "ConfigMap"),
                            Map.entry("metadata", Map.ofEntries(
                                Map.entry("name", "my-map")
                            ))
                        ))
                        .build());
            });
        }
    }
    
    import pulumi
    from pulumi_kubernetes.yaml.v2 import ConfigGroup
    
    example = ConfigGroup(
        "example",
        objs=[
            {
                "apiVersion": "v1",
                "kind": "ConfigMap",
                "metadata": {
                    "name": "my-map",
                },
            }
        ]
    )
    
    import * as pulumi from "@pulumi/pulumi";
    import * as k8s from "@pulumi/kubernetes";
    
    const example = new k8s.yaml.v2.ConfigGroup("example", {
        objs: [
            {
                apiVersion: "v1",
                kind: "ConfigMap",
                metadata: {
                    name: "my-map"
                }
            }
        ]
    });
    
    name: example
    runtime: yaml
    resources:
      example:
        type: kubernetes:yaml/v2:ConfigGroup
        properties:
          objs:
          - apiVersion: v1
            kind: ConfigMap
            metadata:
              name: my-map
    

    Create ConfigGroup Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ConfigGroup(name: string, args?: ConfigGroupOpts, opts?: ComponentResourceOptions);
    @overload
    def ConfigGroup(resource_name: str,
                    args: Optional[ConfigGroupArgs] = None,
                    opts: Optional[ResourceOptions] = None)
    
    @overload
    def ConfigGroup(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    files: Optional[Sequence[str]] = None,
                    objs: Optional[Sequence[Any]] = None,
                    resource_prefix: Optional[str] = None,
                    skip_await: Optional[bool] = None,
                    yaml: Optional[str] = None)
    func NewConfigGroup(ctx *Context, name string, args *ConfigGroupArgs, opts ...ResourceOption) (*ConfigGroup, error)
    public ConfigGroup(string name, ConfigGroupArgs? args = null, ComponentResourceOptions? opts = null)
    public ConfigGroup(String name, ConfigGroupArgs args)
    public ConfigGroup(String name, ConfigGroupArgs args, ComponentResourceOptions options)
    
    type: kubernetes:yaml/v2:ConfigGroup
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args ConfigGroupOpts
    The arguments to resource properties.
    opts ComponentResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args ConfigGroupArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args ConfigGroupArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ConfigGroupArgs
    The arguments to resource properties.
    opts ComponentResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ConfigGroupArgs
    The arguments to resource properties.
    options ComponentResourceOptions
    Bag of options to control resource's behavior.

    ConfigGroup Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The ConfigGroup resource accepts the following input properties:

    Files List<string>
    Set of paths and/or URLs to Kubernetes manifest files. Supports glob patterns.
    Objs List<object>
    Objects representing Kubernetes resource configurations.
    ResourcePrefix string
    A prefix for the auto-generated resource names. Defaults to the name of the ConfigGroup. Example: A resource created with resourcePrefix="foo" would produce a resource named "foo-resourceName".
    SkipAwait bool
    Indicates that child resources should skip the await logic.
    Yaml string
    A Kubernetes YAML manifest containing Kubernetes resource configuration(s).
    Files []string
    Set of paths and/or URLs to Kubernetes manifest files. Supports glob patterns.
    Objs []interface{}
    Objects representing Kubernetes resource configurations.
    ResourcePrefix string
    A prefix for the auto-generated resource names. Defaults to the name of the ConfigGroup. Example: A resource created with resourcePrefix="foo" would produce a resource named "foo-resourceName".
    SkipAwait bool
    Indicates that child resources should skip the await logic.
    Yaml string
    A Kubernetes YAML manifest containing Kubernetes resource configuration(s).
    files List<String>
    Set of paths and/or URLs to Kubernetes manifest files. Supports glob patterns.
    objs List<Object>
    Objects representing Kubernetes resource configurations.
    resourcePrefix String
    A prefix for the auto-generated resource names. Defaults to the name of the ConfigGroup. Example: A resource created with resourcePrefix="foo" would produce a resource named "foo-resourceName".
    skipAwait Boolean
    Indicates that child resources should skip the await logic.
    yaml String
    A Kubernetes YAML manifest containing Kubernetes resource configuration(s).
    files string[]
    Set of paths and/or URLs to Kubernetes manifest files. Supports glob patterns.
    objs any[]
    Objects representing Kubernetes resource configurations.
    resourcePrefix string
    A prefix for the auto-generated resource names. Defaults to the name of the ConfigGroup. Example: A resource created with resourcePrefix="foo" would produce a resource named "foo-resourceName".
    skipAwait boolean
    Indicates that child resources should skip the await logic.
    yaml string
    A Kubernetes YAML manifest containing Kubernetes resource configuration(s).
    files Sequence[str]
    Set of paths and/or URLs to Kubernetes manifest files. Supports glob patterns.
    objs Sequence[Any]
    Objects representing Kubernetes resource configurations.
    resource_prefix str
    A prefix for the auto-generated resource names. Defaults to the name of the ConfigGroup. Example: A resource created with resourcePrefix="foo" would produce a resource named "foo-resourceName".
    skip_await bool
    Indicates that child resources should skip the await logic.
    yaml str
    A Kubernetes YAML manifest containing Kubernetes resource configuration(s).
    files List<String>
    Set of paths and/or URLs to Kubernetes manifest files. Supports glob patterns.
    objs List<Any>
    Objects representing Kubernetes resource configurations.
    resourcePrefix String
    A prefix for the auto-generated resource names. Defaults to the name of the ConfigGroup. Example: A resource created with resourcePrefix="foo" would produce a resource named "foo-resourceName".
    skipAwait Boolean
    Indicates that child resources should skip the await logic.
    yaml String
    A Kubernetes YAML manifest containing Kubernetes resource configuration(s).

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ConfigGroup resource produces the following output properties:

    Resources List<object>
    Resources created by the ConfigGroup.
    Resources []interface{}
    Resources created by the ConfigGroup.
    resources List<Object>
    Resources created by the ConfigGroup.
    resources any[]
    Resources created by the ConfigGroup.
    resources Sequence[Any]
    Resources created by the ConfigGroup.
    resources List<Any>
    Resources created by the ConfigGroup.

    Package Details

    Repository
    Kubernetes pulumi/pulumi-kubernetes
    License
    Apache-2.0
    kubernetes logo
    Kubernetes v4.18.4 published on Thursday, Dec 5, 2024 by Pulumi