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

harness.Environment

Explore with Pulumi AI

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

    Resource for creating an environment

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Harness = Lbrlabs.PulumiPackage.Harness;
    
    return await Deployment.RunAsync(() => 
    {
        var testApplication = new Harness.Application("testApplication");
    
        var testKubernetes = new Harness.Service.Kubernetes("testKubernetes", new()
        {
            AppId = testApplication.Id,
            HelmVersion = "V2",
            Description = "description",
            Variables = new[]
            {
                new Harness.Service.Inputs.KubernetesVariableArgs
                {
                    Name = "test",
                    Value = "test_value",
                    Type = "TEXT",
                },
                new Harness.Service.Inputs.KubernetesVariableArgs
                {
                    Name = "test2",
                    Value = "test_value2",
                    Type = "TEXT",
                },
            },
        });
    
        var testEnvironment = new Harness.Environment("testEnvironment", new()
        {
            AppId = testApplication.Id,
            Type = "%[2]s",
            VariableOverrides = new[]
            {
                new Harness.Inputs.EnvironmentVariableOverrideArgs
                {
                    ServiceName = testKubernetes.Name,
                    Name = "test",
                    Value = "override",
                    Type = "TEXT",
                },
                new Harness.Inputs.EnvironmentVariableOverrideArgs
                {
                    ServiceName = testKubernetes.Name,
                    Name = "test2",
                    Value = "override2",
                    Type = "TEXT",
                },
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/lbrlabs/pulumi-harness/sdk/go/harness"
    	"github.com/lbrlabs/pulumi-harness/sdk/go/harness/service"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		testApplication, err := harness.NewApplication(ctx, "testApplication", nil)
    		if err != nil {
    			return err
    		}
    		testKubernetes, err := service.NewKubernetes(ctx, "testKubernetes", &service.KubernetesArgs{
    			AppId:       testApplication.ID(),
    			HelmVersion: pulumi.String("V2"),
    			Description: pulumi.String("description"),
    			Variables: service.KubernetesVariableArray{
    				&service.KubernetesVariableArgs{
    					Name:  pulumi.String("test"),
    					Value: pulumi.String("test_value"),
    					Type:  pulumi.String("TEXT"),
    				},
    				&service.KubernetesVariableArgs{
    					Name:  pulumi.String("test2"),
    					Value: pulumi.String("test_value2"),
    					Type:  pulumi.String("TEXT"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = harness.NewEnvironment(ctx, "testEnvironment", &harness.EnvironmentArgs{
    			AppId: testApplication.ID(),
    			Type:  pulumi.String("%[2]s"),
    			VariableOverrides: harness.EnvironmentVariableOverrideArray{
    				&harness.EnvironmentVariableOverrideArgs{
    					ServiceName: testKubernetes.Name,
    					Name:        pulumi.String("test"),
    					Value:       pulumi.String("override"),
    					Type:        pulumi.String("TEXT"),
    				},
    				&harness.EnvironmentVariableOverrideArgs{
    					ServiceName: testKubernetes.Name,
    					Name:        pulumi.String("test2"),
    					Value:       pulumi.String("override2"),
    					Type:        pulumi.String("TEXT"),
    				},
    			},
    		})
    		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.Application;
    import com.pulumi.harness.service.Kubernetes;
    import com.pulumi.harness.service.KubernetesArgs;
    import com.pulumi.harness.service.inputs.KubernetesVariableArgs;
    import com.pulumi.harness.Environment;
    import com.pulumi.harness.EnvironmentArgs;
    import com.pulumi.harness.inputs.EnvironmentVariableOverrideArgs;
    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 testApplication = new Application("testApplication");
    
            var testKubernetes = new Kubernetes("testKubernetes", KubernetesArgs.builder()        
                .appId(testApplication.id())
                .helmVersion("V2")
                .description("description")
                .variables(            
                    KubernetesVariableArgs.builder()
                        .name("test")
                        .value("test_value")
                        .type("TEXT")
                        .build(),
                    KubernetesVariableArgs.builder()
                        .name("test2")
                        .value("test_value2")
                        .type("TEXT")
                        .build())
                .build());
    
            var testEnvironment = new Environment("testEnvironment", EnvironmentArgs.builder()        
                .appId(testApplication.id())
                .type("%[2]s")
                .variableOverrides(            
                    EnvironmentVariableOverrideArgs.builder()
                        .serviceName(testKubernetes.name())
                        .name("test")
                        .value("override")
                        .type("TEXT")
                        .build(),
                    EnvironmentVariableOverrideArgs.builder()
                        .serviceName(testKubernetes.name())
                        .name("test2")
                        .value("override2")
                        .type("TEXT")
                        .build())
                .build());
    
        }
    }
    
    import pulumi
    import lbrlabs_pulumi_harness as harness
    
    test_application = harness.Application("testApplication")
    test_kubernetes = harness.service.Kubernetes("testKubernetes",
        app_id=test_application.id,
        helm_version="V2",
        description="description",
        variables=[
            harness.service.KubernetesVariableArgs(
                name="test",
                value="test_value",
                type="TEXT",
            ),
            harness.service.KubernetesVariableArgs(
                name="test2",
                value="test_value2",
                type="TEXT",
            ),
        ])
    test_environment = harness.Environment("testEnvironment",
        app_id=test_application.id,
        type="%[2]s",
        variable_overrides=[
            harness.EnvironmentVariableOverrideArgs(
                service_name=test_kubernetes.name,
                name="test",
                value="override",
                type="TEXT",
            ),
            harness.EnvironmentVariableOverrideArgs(
                service_name=test_kubernetes.name,
                name="test2",
                value="override2",
                type="TEXT",
            ),
        ])
    
    import * as pulumi from "@pulumi/pulumi";
    import * as harness from "@lbrlabs/pulumi-harness";
    
    const testApplication = new harness.Application("testApplication", {});
    const testKubernetes = new harness.service.Kubernetes("testKubernetes", {
        appId: testApplication.id,
        helmVersion: "V2",
        description: "description",
        variables: [
            {
                name: "test",
                value: "test_value",
                type: "TEXT",
            },
            {
                name: "test2",
                value: "test_value2",
                type: "TEXT",
            },
        ],
    });
    const testEnvironment = new harness.Environment("testEnvironment", {
        appId: testApplication.id,
        type: "%[2]s",
        variableOverrides: [
            {
                serviceName: testKubernetes.name,
                name: "test",
                value: "override",
                type: "TEXT",
            },
            {
                serviceName: testKubernetes.name,
                name: "test2",
                value: "override2",
                type: "TEXT",
            },
        ],
    });
    
    resources:
      testApplication:
        type: harness:Application
      testKubernetes:
        type: harness:service:Kubernetes
        properties:
          appId: ${testApplication.id}
          helmVersion: V2
          description: description
          variables:
            - name: test
              value: test_value
              type: TEXT
            - name: test2
              value: test_value2
              type: TEXT
      testEnvironment:
        type: harness:Environment
        properties:
          appId: ${testApplication.id}
          type: '%[2]s'
          variableOverrides:
            - serviceName: ${testKubernetes.name}
              name: test
              value: override
              type: TEXT
            - serviceName: ${testKubernetes.name}
              name: test2
              value: override2
              type: TEXT
    

    Create Environment Resource

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

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

    AppId string

    The id of the application.

    Type string

    The type of the environment. Valid values are PROD and NON_PROD

    Description string

    The description of the environment.

    Name string

    The name of the environment.

    VariableOverrides List<Lbrlabs.PulumiPackage.Harness.Inputs.EnvironmentVariableOverride>

    Override for a service variable

    AppId string

    The id of the application.

    Type string

    The type of the environment. Valid values are PROD and NON_PROD

    Description string

    The description of the environment.

    Name string

    The name of the environment.

    VariableOverrides []EnvironmentVariableOverrideArgs

    Override for a service variable

    appId String

    The id of the application.

    type String

    The type of the environment. Valid values are PROD and NON_PROD

    description String

    The description of the environment.

    name String

    The name of the environment.

    variableOverrides List<EnvironmentVariableOverride>

    Override for a service variable

    appId string

    The id of the application.

    type string

    The type of the environment. Valid values are PROD and NON_PROD

    description string

    The description of the environment.

    name string

    The name of the environment.

    variableOverrides EnvironmentVariableOverride[]

    Override for a service variable

    app_id str

    The id of the application.

    type str

    The type of the environment. Valid values are PROD and NON_PROD

    description str

    The description of the environment.

    name str

    The name of the environment.

    variable_overrides Sequence[EnvironmentVariableOverrideArgs]

    Override for a service variable

    appId String

    The id of the application.

    type String

    The type of the environment. Valid values are PROD and NON_PROD

    description String

    The description of the environment.

    name String

    The name of the environment.

    variableOverrides List<Property Map>

    Override for a service variable

    Outputs

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

    Id string

    The provider-assigned unique ID for this managed resource.

    Id string

    The provider-assigned unique ID for this managed resource.

    id String

    The provider-assigned unique ID for this managed resource.

    id string

    The provider-assigned unique ID for this managed resource.

    id str

    The provider-assigned unique ID for this managed resource.

    id String

    The provider-assigned unique ID for this managed resource.

    Look up Existing Environment Resource

    Get an existing Environment 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?: EnvironmentState, opts?: CustomResourceOptions): Environment
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            app_id: Optional[str] = None,
            description: Optional[str] = None,
            name: Optional[str] = None,
            type: Optional[str] = None,
            variable_overrides: Optional[Sequence[EnvironmentVariableOverrideArgs]] = None) -> Environment
    func GetEnvironment(ctx *Context, name string, id IDInput, state *EnvironmentState, opts ...ResourceOption) (*Environment, error)
    public static Environment Get(string name, Input<string> id, EnvironmentState? state, CustomResourceOptions? opts = null)
    public static Environment get(String name, Output<String> id, EnvironmentState 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.

    Description string

    The description of the environment.

    Name string

    The name of the environment.

    Type string

    The type of the environment. Valid values are PROD and NON_PROD

    VariableOverrides List<Lbrlabs.PulumiPackage.Harness.Inputs.EnvironmentVariableOverride>

    Override for a service variable

    AppId string

    The id of the application.

    Description string

    The description of the environment.

    Name string

    The name of the environment.

    Type string

    The type of the environment. Valid values are PROD and NON_PROD

    VariableOverrides []EnvironmentVariableOverrideArgs

    Override for a service variable

    appId String

    The id of the application.

    description String

    The description of the environment.

    name String

    The name of the environment.

    type String

    The type of the environment. Valid values are PROD and NON_PROD

    variableOverrides List<EnvironmentVariableOverride>

    Override for a service variable

    appId string

    The id of the application.

    description string

    The description of the environment.

    name string

    The name of the environment.

    type string

    The type of the environment. Valid values are PROD and NON_PROD

    variableOverrides EnvironmentVariableOverride[]

    Override for a service variable

    app_id str

    The id of the application.

    description str

    The description of the environment.

    name str

    The name of the environment.

    type str

    The type of the environment. Valid values are PROD and NON_PROD

    variable_overrides Sequence[EnvironmentVariableOverrideArgs]

    Override for a service variable

    appId String

    The id of the application.

    description String

    The description of the environment.

    name String

    The name of the environment.

    type String

    The type of the environment. Valid values are PROD and NON_PROD

    variableOverrides List<Property Map>

    Override for a service variable

    Supporting Types

    EnvironmentVariableOverride, EnvironmentVariableOverrideArgs

    Name string

    The name of the variable

    Type string

    The type of the service variable. Valid values are TEXT and ENCRYPTED_TEXT

    Value string

    The value of the service variable

    ServiceName string

    The name of the service

    Name string

    The name of the variable

    Type string

    The type of the service variable. Valid values are TEXT and ENCRYPTED_TEXT

    Value string

    The value of the service variable

    ServiceName string

    The name of the service

    name String

    The name of the variable

    type String

    The type of the service variable. Valid values are TEXT and ENCRYPTED_TEXT

    value String

    The value of the service variable

    serviceName String

    The name of the service

    name string

    The name of the variable

    type string

    The type of the service variable. Valid values are TEXT and ENCRYPTED_TEXT

    value string

    The value of the service variable

    serviceName string

    The name of the service

    name str

    The name of the variable

    type str

    The type of the service variable. Valid values are TEXT and ENCRYPTED_TEXT

    value str

    The value of the service variable

    service_name str

    The name of the service

    name String

    The name of the variable

    type String

    The type of the service variable. Valid values are TEXT and ENCRYPTED_TEXT

    value String

    The value of the service variable

    serviceName String

    The name of the service

    Import

    Import using the Harness application id and environment id.

     $ pulumi import harness:index/environment:Environment dev <application_id>/<environment_id>
    

    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