1. Packages
  2. Harness
  3. API Docs
  4. YamlConfig
Harness v0.0.6 published on Saturday, Jul 1, 2023 by lbrlabs

harness.YamlConfig

Explore with Pulumi AI

harness logo
Harness v0.0.6 published on Saturday, Jul 1, 2023 by lbrlabs

    Resource for creating a raw YAML configuration in Harness. Note: This works for all objects EXCEPT application objects. This resource uses the config-as-code API’s. When updating the name or path of this resource you should typically also set the create_before_destroy = true lifecycle setting.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Harness = Lbrlabs.PulumiPackage.Harness;
    
    return await Deployment.RunAsync(() => 
    {
        var test = new Harness.YamlConfig("test", new()
        {
            Content = @"harnessApiVersion: '1.0'
    type: KUBERNETES_CLUSTER
    delegateSelectors:
    - k8s
    skipValidation: true
    useKubernetesDelegate: true
    
    ",
            Path = "Setup/Cloud Providers/Kubernetes.yaml",
        });
    
    });
    
    package main
    
    import (
    	"github.com/lbrlabs/pulumi-harness/sdk/go/harness"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := harness.NewYamlConfig(ctx, "test", &harness.YamlConfigArgs{
    			Content: pulumi.String(`harnessApiVersion: '1.0'
    type: KUBERNETES_CLUSTER
    delegateSelectors:
    - k8s
    skipValidation: true
    useKubernetesDelegate: true
    
    `),
    			Path: pulumi.String("Setup/Cloud Providers/Kubernetes.yaml"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.harness.YamlConfig;
    import com.pulumi.harness.YamlConfigArgs;
    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) {
            var test = new YamlConfig("test", YamlConfigArgs.builder()        
                .content("""
    harnessApiVersion: '1.0'
    type: KUBERNETES_CLUSTER
    delegateSelectors:
    - k8s
    skipValidation: true
    useKubernetesDelegate: true
    
                """)
                .path("Setup/Cloud Providers/Kubernetes.yaml")
                .build());
    
        }
    }
    
    import pulumi
    import lbrlabs_pulumi_harness as harness
    
    test = harness.YamlConfig("test",
        content="""harnessApiVersion: '1.0'
    type: KUBERNETES_CLUSTER
    delegateSelectors:
    - k8s
    skipValidation: true
    useKubernetesDelegate: true
    
    """,
        path="Setup/Cloud Providers/Kubernetes.yaml")
    
    import * as pulumi from "@pulumi/pulumi";
    import * as harness from "@lbrlabs/pulumi-harness";
    
    const test = new harness.YamlConfig("test", {
        content: `harnessApiVersion: '1.0'
    type: KUBERNETES_CLUSTER
    delegateSelectors:
    - k8s
    skipValidation: true
    useKubernetesDelegate: true
    
    `,
        path: "Setup/Cloud Providers/Kubernetes.yaml",
    });
    
    resources:
      test:
        type: harness:YamlConfig
        properties:
          content: |+
            harnessApiVersion: '1.0'
            type: KUBERNETES_CLUSTER
            delegateSelectors:
            - k8s
            skipValidation: true
            useKubernetesDelegate: true        
    
          path: Setup/Cloud Providers/Kubernetes.yaml
    

    Create YamlConfig Resource

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

    Constructor syntax

    new YamlConfig(name: string, args: YamlConfigArgs, opts?: CustomResourceOptions);
    @overload
    def YamlConfig(resource_name: str,
                   args: YamlConfigArgs,
                   opts: Optional[ResourceOptions] = None)
    
    @overload
    def YamlConfig(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   content: Optional[str] = None,
                   path: Optional[str] = None,
                   app_id: Optional[str] = None)
    func NewYamlConfig(ctx *Context, name string, args YamlConfigArgs, opts ...ResourceOption) (*YamlConfig, error)
    public YamlConfig(string name, YamlConfigArgs args, CustomResourceOptions? opts = null)
    public YamlConfig(String name, YamlConfigArgs args)
    public YamlConfig(String name, YamlConfigArgs args, CustomResourceOptions options)
    
    type: harness:YamlConfig
    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 YamlConfigArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args YamlConfigArgs
    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 YamlConfigArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args YamlConfigArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args YamlConfigArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var yamlConfigResource = new Harness.YamlConfig("yamlConfigResource", new()
    {
        Content = "string",
        Path = "string",
        AppId = "string",
    });
    
    example, err := harness.NewYamlConfig(ctx, "yamlConfigResource", &harness.YamlConfigArgs{
    	Content: pulumi.String("string"),
    	Path:    pulumi.String("string"),
    	AppId:   pulumi.String("string"),
    })
    
    var yamlConfigResource = new YamlConfig("yamlConfigResource", YamlConfigArgs.builder()
        .content("string")
        .path("string")
        .appId("string")
        .build());
    
    yaml_config_resource = harness.YamlConfig("yamlConfigResource",
        content="string",
        path="string",
        app_id="string")
    
    const yamlConfigResource = new harness.YamlConfig("yamlConfigResource", {
        content: "string",
        path: "string",
        appId: "string",
    });
    
    type: harness:YamlConfig
    properties:
        appId: string
        content: string
        path: string
    

    YamlConfig Resource Properties

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

    Inputs

    The YamlConfig resource accepts the following input properties:

    Content string
    The raw YAML configuration.
    Path string
    The path of the resource.
    AppId string
    The id of the application. This is required for all resources except global ones.
    Content string
    The raw YAML configuration.
    Path string
    The path of the resource.
    AppId string
    The id of the application. This is required for all resources except global ones.
    content String
    The raw YAML configuration.
    path String
    The path of the resource.
    appId String
    The id of the application. This is required for all resources except global ones.
    content string
    The raw YAML configuration.
    path string
    The path of the resource.
    appId string
    The id of the application. This is required for all resources except global ones.
    content str
    The raw YAML configuration.
    path str
    The path of the resource.
    app_id str
    The id of the application. This is required for all resources except global ones.
    content String
    The raw YAML configuration.
    path String
    The path of the resource.
    appId String
    The id of the application. This is required for all resources except global ones.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    The name of the resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    The name of the resource.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    The name of the resource.
    id string
    The provider-assigned unique ID for this managed resource.
    name string
    The name of the resource.
    id str
    The provider-assigned unique ID for this managed resource.
    name str
    The name of the resource.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    The name of the resource.

    Look up Existing YamlConfig Resource

    Get an existing YamlConfig resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: YamlConfigState, opts?: CustomResourceOptions): YamlConfig
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            app_id: Optional[str] = None,
            content: Optional[str] = None,
            name: Optional[str] = None,
            path: Optional[str] = None) -> YamlConfig
    func GetYamlConfig(ctx *Context, name string, id IDInput, state *YamlConfigState, opts ...ResourceOption) (*YamlConfig, error)
    public static YamlConfig Get(string name, Input<string> id, YamlConfigState? state, CustomResourceOptions? opts = null)
    public static YamlConfig get(String name, Output<String> id, YamlConfigState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    AppId string
    The id of the application. This is required for all resources except global ones.
    Content string
    The raw YAML configuration.
    Name string
    The name of the resource.
    Path string
    The path of the resource.
    AppId string
    The id of the application. This is required for all resources except global ones.
    Content string
    The raw YAML configuration.
    Name string
    The name of the resource.
    Path string
    The path of the resource.
    appId String
    The id of the application. This is required for all resources except global ones.
    content String
    The raw YAML configuration.
    name String
    The name of the resource.
    path String
    The path of the resource.
    appId string
    The id of the application. This is required for all resources except global ones.
    content string
    The raw YAML configuration.
    name string
    The name of the resource.
    path string
    The path of the resource.
    app_id str
    The id of the application. This is required for all resources except global ones.
    content str
    The raw YAML configuration.
    name str
    The name of the resource.
    path str
    The path of the resource.
    appId String
    The id of the application. This is required for all resources except global ones.
    content String
    The raw YAML configuration.
    name String
    The name of the resource.
    path String
    The path of the resource.

    Import

    Importing a global config only using the yaml path

     $ pulumi import harness:index/yamlConfig:YamlConfig k8s_cloudprovider "Setup/Cloud Providers/kubernetes.yaml"
    

    Importing a service which requires both the application id and the yaml path.

     $ pulumi import harness:index/yamlConfig:YamlConfig k8s_cloudprovider "Setup/Applications/MyApp/Services/MyService/Index.yaml:<APPLICATION_ID>"
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    harness lbrlabs/pulumi-harness
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the harness Terraform Provider.
    harness logo
    Harness v0.0.6 published on Saturday, Jul 1, 2023 by lbrlabs