azuredevops.getEnvironment
Explore with Pulumi AI
Use this data source to access information about an Environment.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as azuredevops from "@pulumi/azuredevops";
const exampleProject = new azuredevops.Project("example", {
    name: "Example Project",
    workItemTemplate: "Agile",
    versionControl: "Git",
    visibility: "private",
    description: "Managed by Pulumi",
});
const exampleEnvironment = new azuredevops.Environment("example", {
    projectId: exampleProject.id,
    name: "Example Environment",
    description: "Managed by Pulumi",
});
const example = pulumi.all([exampleProject.id, exampleEnvironment.id]).apply(([exampleProjectId, exampleEnvironmentId]) => azuredevops.getEnvironmentOutput({
    projectId: exampleProjectId,
    environmentId: exampleEnvironmentId,
}));
import pulumi
import pulumi_azuredevops as azuredevops
example_project = azuredevops.Project("example",
    name="Example Project",
    work_item_template="Agile",
    version_control="Git",
    visibility="private",
    description="Managed by Pulumi")
example_environment = azuredevops.Environment("example",
    project_id=example_project.id,
    name="Example Environment",
    description="Managed by Pulumi")
example = pulumi.Output.all(
    exampleProjectId=example_project.id,
    exampleEnvironmentId=example_environment.id
).apply(lambda resolved_outputs: azuredevops.get_environment_output(project_id=resolved_outputs['exampleProjectId'],
    environment_id=%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference)))
package main
import (
	"github.com/pulumi/pulumi-azuredevops/sdk/v3/go/azuredevops"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		exampleProject, err := azuredevops.NewProject(ctx, "example", &azuredevops.ProjectArgs{
			Name:             pulumi.String("Example Project"),
			WorkItemTemplate: pulumi.String("Agile"),
			VersionControl:   pulumi.String("Git"),
			Visibility:       pulumi.String("private"),
			Description:      pulumi.String("Managed by Pulumi"),
		})
		if err != nil {
			return err
		}
		exampleEnvironment, err := azuredevops.NewEnvironment(ctx, "example", &azuredevops.EnvironmentArgs{
			ProjectId:   exampleProject.ID(),
			Name:        pulumi.String("Example Environment"),
			Description: pulumi.String("Managed by Pulumi"),
		})
		if err != nil {
			return err
		}
		_ = pulumi.All(exampleProject.ID(), exampleEnvironment.ID()).ApplyT(func(_args []interface{}) (azuredevops.GetEnvironmentResult, error) {
			exampleProjectId := _args[0].(string)
			exampleEnvironmentId := _args[1].(string)
			return azuredevops.GetEnvironmentResult(interface{}(azuredevops.LookupEnvironmentOutput(ctx, azuredevops.GetEnvironmentOutputArgs{
				ProjectId:     exampleProjectId,
				EnvironmentId: exampleEnvironmentId,
			}, nil))), nil
		}).(azuredevops.GetEnvironmentResultOutput)
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureDevOps = Pulumi.AzureDevOps;
return await Deployment.RunAsync(() => 
{
    var exampleProject = new AzureDevOps.Project("example", new()
    {
        Name = "Example Project",
        WorkItemTemplate = "Agile",
        VersionControl = "Git",
        Visibility = "private",
        Description = "Managed by Pulumi",
    });
    var exampleEnvironment = new AzureDevOps.Environment("example", new()
    {
        ProjectId = exampleProject.Id,
        Name = "Example Environment",
        Description = "Managed by Pulumi",
    });
    var example = AzureDevOps.GetEnvironment.Invoke(new()
    {
        ProjectId = exampleProject.Id,
        EnvironmentId = exampleEnvironment.Id,
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azuredevops.Project;
import com.pulumi.azuredevops.ProjectArgs;
import com.pulumi.azuredevops.Environment;
import com.pulumi.azuredevops.EnvironmentArgs;
import com.pulumi.azuredevops.AzuredevopsFunctions;
import com.pulumi.azuredevops.inputs.GetEnvironmentArgs;
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 exampleProject = new Project("exampleProject", ProjectArgs.builder()
            .name("Example Project")
            .workItemTemplate("Agile")
            .versionControl("Git")
            .visibility("private")
            .description("Managed by Pulumi")
            .build());
        var exampleEnvironment = new Environment("exampleEnvironment", EnvironmentArgs.builder()
            .projectId(exampleProject.id())
            .name("Example Environment")
            .description("Managed by Pulumi")
            .build());
        final var example = AzuredevopsFunctions.getEnvironment(GetEnvironmentArgs.builder()
            .projectId(exampleProject.id())
            .environmentId(exampleEnvironment.id())
            .build());
    }
}
resources:
  exampleProject:
    type: azuredevops:Project
    name: example
    properties:
      name: Example Project
      workItemTemplate: Agile
      versionControl: Git
      visibility: private
      description: Managed by Pulumi
  exampleEnvironment:
    type: azuredevops:Environment
    name: example
    properties:
      projectId: ${exampleProject.id}
      name: Example Environment
      description: Managed by Pulumi
variables:
  example:
    fn::invoke:
      function: azuredevops:getEnvironment
      arguments:
        projectId: ${exampleProject.id}
        environmentId: ${exampleEnvironment.id}
Relevant Links
Using getEnvironment
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getEnvironment(args: GetEnvironmentArgs, opts?: InvokeOptions): Promise<GetEnvironmentResult>
function getEnvironmentOutput(args: GetEnvironmentOutputArgs, opts?: InvokeOptions): Output<GetEnvironmentResult>def get_environment(environment_id: Optional[int] = None,
                    name: Optional[str] = None,
                    project_id: Optional[str] = None,
                    opts: Optional[InvokeOptions] = None) -> GetEnvironmentResult
def get_environment_output(environment_id: Optional[pulumi.Input[int]] = None,
                    name: Optional[pulumi.Input[str]] = None,
                    project_id: Optional[pulumi.Input[str]] = None,
                    opts: Optional[InvokeOptions] = None) -> Output[GetEnvironmentResult]func LookupEnvironment(ctx *Context, args *LookupEnvironmentArgs, opts ...InvokeOption) (*LookupEnvironmentResult, error)
func LookupEnvironmentOutput(ctx *Context, args *LookupEnvironmentOutputArgs, opts ...InvokeOption) LookupEnvironmentResultOutput> Note: This function is named LookupEnvironment in the Go SDK.
public static class GetEnvironment 
{
    public static Task<GetEnvironmentResult> InvokeAsync(GetEnvironmentArgs args, InvokeOptions? opts = null)
    public static Output<GetEnvironmentResult> Invoke(GetEnvironmentInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetEnvironmentResult> getEnvironment(GetEnvironmentArgs args, InvokeOptions options)
public static Output<GetEnvironmentResult> getEnvironment(GetEnvironmentArgs args, InvokeOptions options)
fn::invoke:
  function: azuredevops:index/getEnvironment:getEnvironment
  arguments:
    # arguments dictionaryThe following arguments are supported:
- ProjectId string
- The ID of the project.
- EnvironmentId int
- The ID of the Environment.
- Name string
- Name of the Environment. - NOTE: One of either - environment_idor- namemust be specified.
- ProjectId string
- The ID of the project.
- EnvironmentId int
- The ID of the Environment.
- Name string
- Name of the Environment. - NOTE: One of either - environment_idor- namemust be specified.
- projectId String
- The ID of the project.
- environmentId Integer
- The ID of the Environment.
- name String
- Name of the Environment. - NOTE: One of either - environment_idor- namemust be specified.
- projectId string
- The ID of the project.
- environmentId number
- The ID of the Environment.
- name string
- Name of the Environment. - NOTE: One of either - environment_idor- namemust be specified.
- project_id str
- The ID of the project.
- environment_id int
- The ID of the Environment.
- name str
- Name of the Environment. - NOTE: One of either - environment_idor- namemust be specified.
- projectId String
- The ID of the project.
- environmentId Number
- The ID of the Environment.
- name String
- Name of the Environment. - NOTE: One of either - environment_idor- namemust be specified.
getEnvironment Result
The following output properties are available:
- Description string
- A description for the Environment.
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- The name of the Environment.
- ProjectId string
- EnvironmentId int
- Description string
- A description for the Environment.
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- The name of the Environment.
- ProjectId string
- EnvironmentId int
- description String
- A description for the Environment.
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- The name of the Environment.
- projectId String
- environmentId Integer
- description string
- A description for the Environment.
- id string
- The provider-assigned unique ID for this managed resource.
- name string
- The name of the Environment.
- projectId string
- environmentId number
- description str
- A description for the Environment.
- id str
- The provider-assigned unique ID for this managed resource.
- name str
- The name of the Environment.
- project_id str
- environment_id int
- description String
- A description for the Environment.
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- The name of the Environment.
- projectId String
- environmentId Number
Package Details
- Repository
- Azure DevOps pulumi/pulumi-azuredevops
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the azuredevopsTerraform Provider.