harness.Environment
Explore with Pulumi AI
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
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Environment(name: string, args: EnvironmentArgs, opts?: CustomResourceOptions);@overload
def Environment(resource_name: str,
                args: EnvironmentArgs,
                opts: Optional[ResourceOptions] = None)
@overload
def Environment(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                app_id: Optional[str] = None,
                type: Optional[str] = None,
                description: Optional[str] = None,
                name: Optional[str] = None,
                variable_overrides: Optional[Sequence[EnvironmentVariableOverrideArgs]] = 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.
Parameters
- 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.
 
Constructor example
The following reference example uses placeholder values for all input properties.
var environmentResource = new Harness.Environment("environmentResource", new()
{
    AppId = "string",
    Type = "string",
    Description = "string",
    Name = "string",
    VariableOverrides = new[]
    {
        new Harness.Inputs.EnvironmentVariableOverrideArgs
        {
            Name = "string",
            Type = "string",
            Value = "string",
            ServiceName = "string",
        },
    },
});
example, err := harness.NewEnvironment(ctx, "environmentResource", &harness.EnvironmentArgs{
	AppId:       pulumi.String("string"),
	Type:        pulumi.String("string"),
	Description: pulumi.String("string"),
	Name:        pulumi.String("string"),
	VariableOverrides: harness.EnvironmentVariableOverrideArray{
		&harness.EnvironmentVariableOverrideArgs{
			Name:        pulumi.String("string"),
			Type:        pulumi.String("string"),
			Value:       pulumi.String("string"),
			ServiceName: pulumi.String("string"),
		},
	},
})
var environmentResource = new Environment("environmentResource", EnvironmentArgs.builder()
    .appId("string")
    .type("string")
    .description("string")
    .name("string")
    .variableOverrides(EnvironmentVariableOverrideArgs.builder()
        .name("string")
        .type("string")
        .value("string")
        .serviceName("string")
        .build())
    .build());
environment_resource = harness.Environment("environmentResource",
    app_id="string",
    type="string",
    description="string",
    name="string",
    variable_overrides=[harness.EnvironmentVariableOverrideArgs(
        name="string",
        type="string",
        value="string",
        service_name="string",
    )])
const environmentResource = new harness.Environment("environmentResource", {
    appId: "string",
    type: "string",
    description: "string",
    name: "string",
    variableOverrides: [{
        name: "string",
        type: "string",
        value: "string",
        serviceName: "string",
    }],
});
type: harness:Environment
properties:
    appId: string
    description: string
    name: string
    type: string
    variableOverrides:
        - name: string
          serviceName: string
          type: string
          value: string
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:
- App
Id string - The id of the application.
 - Type string
 - The type of the environment. Valid values are 
PRODandNON_PROD - Description string
 - The description of the environment.
 - Name string
 - The name of the environment.
 - Variable
Overrides List<Lbrlabs.Pulumi Package. Harness. Inputs. Environment Variable Override>  - Override for a service variable
 
- App
Id string - The id of the application.
 - Type string
 - The type of the environment. Valid values are 
PRODandNON_PROD - Description string
 - The description of the environment.
 - Name string
 - The name of the environment.
 - Variable
Overrides []EnvironmentVariable Override Args  - Override for a service variable
 
- app
Id String - The id of the application.
 - type String
 - The type of the environment. Valid values are 
PRODandNON_PROD - description String
 - The description of the environment.
 - name String
 - The name of the environment.
 - variable
Overrides List<EnvironmentVariable Override>  - Override for a service variable
 
- app
Id string - The id of the application.
 - type string
 - The type of the environment. Valid values are 
PRODandNON_PROD - description string
 - The description of the environment.
 - name string
 - The name of the environment.
 - variable
Overrides EnvironmentVariable Override[]  - Override for a service variable
 
- app_
id str - The id of the application.
 - type str
 - The type of the environment. Valid values are 
PRODandNON_PROD - description str
 - The description of the environment.
 - name str
 - The name of the environment.
 - variable_
overrides Sequence[EnvironmentVariable Override Args]  - Override for a service variable
 
- app
Id String - The id of the application.
 - type String
 - The type of the environment. Valid values are 
PRODandNON_PROD - description String
 - The description of the environment.
 - name String
 - The name of the environment.
 - variable
Overrides 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) -> Environmentfunc 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.
 
- App
Id 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 
PRODandNON_PROD - Variable
Overrides List<Lbrlabs.Pulumi Package. Harness. Inputs. Environment Variable Override>  - Override for a service variable
 
- App
Id 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 
PRODandNON_PROD - Variable
Overrides []EnvironmentVariable Override Args  - Override for a service variable
 
- app
Id 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 
PRODandNON_PROD - variable
Overrides List<EnvironmentVariable Override>  - Override for a service variable
 
- app
Id 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 
PRODandNON_PROD - variable
Overrides EnvironmentVariable Override[]  - 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 
PRODandNON_PROD - variable_
overrides Sequence[EnvironmentVariable Override Args]  - Override for a service variable
 
- app
Id 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 
PRODandNON_PROD - variable
Overrides 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 
TEXTandENCRYPTED_TEXT - Value string
 - The value of the service variable
 - Service
Name string - The name of the service
 
- Name string
 - The name of the variable
 - Type string
 - The type of the service variable. Valid values are 
TEXTandENCRYPTED_TEXT - Value string
 - The value of the service variable
 - Service
Name string - The name of the service
 
- name String
 - The name of the variable
 - type String
 - The type of the service variable. Valid values are 
TEXTandENCRYPTED_TEXT - value String
 - The value of the service variable
 - service
Name String - The name of the service
 
- name string
 - The name of the variable
 - type string
 - The type of the service variable. Valid values are 
TEXTandENCRYPTED_TEXT - value string
 - The value of the service variable
 - service
Name string - The name of the service
 
- name str
 - The name of the variable
 - type str
 - The type of the service variable. Valid values are 
TEXTandENCRYPTED_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 
TEXTandENCRYPTED_TEXT - value String
 - The value of the service variable
 - service
Name 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>
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 
harnessTerraform Provider.