ConfigFile class

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 Scope Format
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.

{{% examples %}}

Example Usage

{{% example %}}

Local File

name: example
runtime: yaml
resources:
  example:
    type: kubernetes:yaml/v2:ConfigFile
    properties:
      file: ./manifest.yaml
import * as pulumi from "@pulumi/pulumi";
import * as k8s from "@pulumi/kubernetes";

const example = new k8s.yaml.v2.ConfigFile("example", {
    file: "./manifest.yaml",
});
import pulumi
from pulumi_kubernetes.yaml.v2 import ConfigFile

example = ConfigFile(
    "example",
    file="./manifest.yaml"
)
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());
        });
    }
}

{{% /example %}} {% /examples %}}

Constructors

ConfigFile(String name, {ConfigFileArgs? args, ComponentResourceOptions? options})
Creates a new ConfigFile. name The Pulumi resource name. args Arguments used to configure this ConfigFile. The set of arguments for ConfigFile. options Resource options controlling this resource's behavior.

Properties

childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
hashCode → int
The hash code for this object.
no setterinherited
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
resources ↔ Output<List<Map<String, dynamic>>?>
Resources created by the ConfigFile.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited

Methods

failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
registerOutputs([Map<String, dynamic>? outputs]) → void
Registers component outputs with the engine.
inherited
registerOutputsAsync(Future<Map<String, dynamic>> outputs) → Future<void>
Async variant of registerOutputs.
inherited
registerOutputsOutput(Output<Map<String, dynamic>> outputs) → void
Registers an already-computed output map.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited