1. Packages
  2. Kubernetes
  3. API Docs
  4. yaml
  5. yaml/v2
  6. ConfigFile
Kubernetes v4.18.3 published on Thursday, Oct 31, 2024 by Pulumi

kubernetes.yaml/v2.ConfigFile

Explore with Pulumi AI

kubernetes logo
Kubernetes v4.18.3 published on Thursday, Oct 31, 2024 by Pulumi

    ConfigFile creates a set of Kubernetes resources from a remote or on-disk Kubernetes YAML file. (If you have in-memory YAML a ConfigGroup may be more appropriate.)

    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 ConfigFile. 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 ConfigFile 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 ConfigFiles

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

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

    Example Usage

    Local File

    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 ConfigFile("example", new ConfigFileArgs
        {
            File = "./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.NewConfigFile(ctx, "example", &yamlv2.ConfigFileArgs{
    			File: pulumi.String("manifest.yaml"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package myproject;
    
    import com.pulumi.Pulumi;
    import com.pulumi.kubernetes.yaml.v2.ConfigFile;
    import com.pulumi.kubernetes.yaml.v2.ConfigFileArgs;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(ctx -> {
                var example = new ConfigFile("example", ConfigFileArgs.builder()
                        .file("./manifest.yaml")
                        .build());
            });
        }
    }
    
    import pulumi
    from pulumi_kubernetes.yaml.v2 import ConfigFile
    
    example = ConfigFile(
        "example",
        file="./manifest.yaml"
    )
    
    import * as pulumi from "@pulumi/pulumi";
    import * as k8s from "@pulumi/kubernetes";
    
    const example = new k8s.yaml.v2.ConfigFile("example", {
        files: ["./manifest.yaml"],
    });
    
    name: example
    runtime: yaml
    resources:
      example:
        type: kubernetes:yaml/v2:ConfigFile
        properties:
          file: ./manifest.yaml
    

    Create ConfigFile Resource

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

    Constructor syntax

    new ConfigFile(name: string, args: ConfigFileOpts, opts?: ComponentResourceOptions);
    @overload
    def ConfigFile(resource_name: str,
                   args: ConfigFileArgs,
                   opts: Optional[ResourceOptions] = None)
    
    @overload
    def ConfigFile(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   file: Optional[str] = None,
                   resource_prefix: Optional[str] = None,
                   skip_await: Optional[bool] = None)
    func NewConfigFile(ctx *Context, name string, args ConfigFileArgs, opts ...ResourceOption) (*ConfigFile, error)
    public ConfigFile(string name, ConfigFileArgs args, ComponentResourceOptions? opts = null)
    public ConfigFile(String name, ConfigFileArgs args)
    public ConfigFile(String name, ConfigFileArgs args, ComponentResourceOptions options)
    
    type: kubernetes:yaml/v2:ConfigFile
    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 ConfigFileOpts
    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 ConfigFileArgs
    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 ConfigFileArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ConfigFileArgs
    The arguments to resource properties.
    opts ComponentResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ConfigFileArgs
    The arguments to resource properties.
    options ComponentResourceOptions
    Bag of options to control resource's behavior.

    ConfigFile 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 ConfigFile resource accepts the following input properties:

    File string
    Path or URL to a Kubernetes manifest file. File must exist.
    ResourcePrefix string
    A prefix for the auto-generated resource names. Defaults to the name of the ConfigFile. 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.
    File string
    Path or URL to a Kubernetes manifest file. File must exist.
    ResourcePrefix string
    A prefix for the auto-generated resource names. Defaults to the name of the ConfigFile. 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.
    file String
    Path or URL to a Kubernetes manifest file. File must exist.
    resourcePrefix String
    A prefix for the auto-generated resource names. Defaults to the name of the ConfigFile. 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.
    file string
    Path or URL to a Kubernetes manifest file. File must exist.
    resourcePrefix string
    A prefix for the auto-generated resource names. Defaults to the name of the ConfigFile. 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.
    file str
    Path or URL to a Kubernetes manifest file. File must exist.
    resource_prefix str
    A prefix for the auto-generated resource names. Defaults to the name of the ConfigFile. 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.
    file String
    Path or URL to a Kubernetes manifest file. File must exist.
    resourcePrefix String
    A prefix for the auto-generated resource names. Defaults to the name of the ConfigFile. 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.

    Outputs

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

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

    Package Details

    Repository
    Kubernetes pulumi/pulumi-kubernetes
    License
    Apache-2.0
    kubernetes logo
    Kubernetes v4.18.3 published on Thursday, Oct 31, 2024 by Pulumi