confluentcloud.getEnvironment
Explore with Pulumi AI
confluentcloud.Environment describes an Environment data source.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as confluentcloud from "@pulumi/confluentcloud";
export = async () => {
    const exampleUsingId = await confluentcloud.getEnvironment({
        id: "env-abc123",
    });
    const exampleUsingName = await confluentcloud.getEnvironment({
        displayName: "stag",
    });
    const exampleUsingNameGetServiceAccount = await confluentcloud.getServiceAccount({
        displayName: "test_sa",
    });
    const test_role_binding = new confluentcloud.RoleBinding("test-role-binding", {
        principal: `User:${exampleUsingNameGetServiceAccount.id}`,
        roleName: "EnvironmentAdmin",
        crnPattern: exampleUsingName.resourceName,
    });
    return {
        exampleUsingId: exampleUsingId,
    };
}
import pulumi
import pulumi_confluentcloud as confluentcloud
example_using_id = confluentcloud.get_environment(id="env-abc123")
pulumi.export("exampleUsingId", example_using_id)
example_using_name = confluentcloud.get_environment(display_name="stag")
example_using_name_get_service_account = confluentcloud.get_service_account(display_name="test_sa")
test_role_binding = confluentcloud.RoleBinding("test-role-binding",
    principal=f"User:{example_using_name_get_service_account.id}",
    role_name="EnvironmentAdmin",
    crn_pattern=example_using_name.resource_name)
package main
import (
	"fmt"
	"github.com/pulumi/pulumi-confluentcloud/sdk/go/confluentcloud"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		exampleUsingId, err := confluentcloud.LookupEnvironment(ctx, &confluentcloud.LookupEnvironmentArgs{
			Id: pulumi.StringRef("env-abc123"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("exampleUsingId", exampleUsingId)
		exampleUsingName, err := confluentcloud.LookupEnvironment(ctx, &confluentcloud.LookupEnvironmentArgs{
			DisplayName: pulumi.StringRef("stag"),
		}, nil)
		if err != nil {
			return err
		}
		exampleUsingNameGetServiceAccount, err := confluentcloud.LookupServiceAccount(ctx, &confluentcloud.LookupServiceAccountArgs{
			DisplayName: pulumi.StringRef("test_sa"),
		}, nil)
		if err != nil {
			return err
		}
		_, err = confluentcloud.NewRoleBinding(ctx, "test-role-binding", &confluentcloud.RoleBindingArgs{
			Principal:  pulumi.String(fmt.Sprintf("User:%v", exampleUsingNameGetServiceAccount.Id)),
			RoleName:   pulumi.String("EnvironmentAdmin"),
			CrnPattern: pulumi.String(exampleUsingName.ResourceName),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using ConfluentCloud = Pulumi.ConfluentCloud;
return await Deployment.RunAsync(() => 
{
    var exampleUsingId = ConfluentCloud.GetEnvironment.Invoke(new()
    {
        Id = "env-abc123",
    });
    var exampleUsingName = ConfluentCloud.GetEnvironment.Invoke(new()
    {
        DisplayName = "stag",
    });
    var exampleUsingNameGetServiceAccount = ConfluentCloud.GetServiceAccount.Invoke(new()
    {
        DisplayName = "test_sa",
    });
    var test_role_binding = new ConfluentCloud.RoleBinding("test-role-binding", new()
    {
        Principal = $"User:{exampleUsingNameGetServiceAccount.Apply(getServiceAccountResult => getServiceAccountResult.Id)}",
        RoleName = "EnvironmentAdmin",
        CrnPattern = exampleUsingName.Apply(getEnvironmentResult => getEnvironmentResult.ResourceName),
    });
    return new Dictionary<string, object?>
    {
        ["exampleUsingId"] = exampleUsingId,
    };
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.confluentcloud.ConfluentcloudFunctions;
import com.pulumi.confluentcloud.inputs.GetEnvironmentArgs;
import com.pulumi.confluentcloud.inputs.GetServiceAccountArgs;
import com.pulumi.confluentcloud.RoleBinding;
import com.pulumi.confluentcloud.RoleBindingArgs;
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) {
        final var exampleUsingId = ConfluentcloudFunctions.getEnvironment(GetEnvironmentArgs.builder()
            .id("env-abc123")
            .build());
        ctx.export("exampleUsingId", exampleUsingId.applyValue(getEnvironmentResult -> getEnvironmentResult));
        final var exampleUsingName = ConfluentcloudFunctions.getEnvironment(GetEnvironmentArgs.builder()
            .displayName("stag")
            .build());
        final var exampleUsingNameGetServiceAccount = ConfluentcloudFunctions.getServiceAccount(GetServiceAccountArgs.builder()
            .displayName("test_sa")
            .build());
        var test_role_binding = new RoleBinding("test-role-binding", RoleBindingArgs.builder()
            .principal(String.format("User:%s", exampleUsingNameGetServiceAccount.applyValue(getServiceAccountResult -> getServiceAccountResult.id())))
            .roleName("EnvironmentAdmin")
            .crnPattern(exampleUsingName.applyValue(getEnvironmentResult -> getEnvironmentResult.resourceName()))
            .build());
    }
}
resources:
  test-role-binding:
    type: confluentcloud:RoleBinding
    properties:
      principal: User:${exampleUsingNameGetServiceAccount.id}
      roleName: EnvironmentAdmin
      crnPattern: ${exampleUsingName.resourceName}
variables:
  exampleUsingId:
    fn::invoke:
      Function: confluentcloud:getEnvironment
      Arguments:
        id: env-abc123
  exampleUsingName:
    fn::invoke:
      Function: confluentcloud:getEnvironment
      Arguments:
        displayName: stag
  exampleUsingNameGetServiceAccount:
    fn::invoke:
      Function: confluentcloud:getServiceAccount
      Arguments:
        displayName: test_sa
outputs:
  exampleUsingId: ${exampleUsingId}
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(display_name: Optional[str] = None,
                    id: Optional[str] = None,
                    stream_governance: Optional[GetEnvironmentStreamGovernance] = None,
                    opts: Optional[InvokeOptions] = None) -> GetEnvironmentResult
def get_environment_output(display_name: Optional[pulumi.Input[str]] = None,
                    id: Optional[pulumi.Input[str]] = None,
                    stream_governance: Optional[pulumi.Input[GetEnvironmentStreamGovernanceArgs]] = 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)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: confluentcloud:index/getEnvironment:getEnvironment
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Display
Name string A human-readable name for the Environment.
Note: Exactly one from the
idanddisplay_nameattributes must be specified.- Id string
 - The ID of the Environment, for example, 
env-abc123. - Stream
Governance Pulumi.Confluent Cloud. Inputs. Get Environment Stream Governance  
- Display
Name string A human-readable name for the Environment.
Note: Exactly one from the
idanddisplay_nameattributes must be specified.- Id string
 - The ID of the Environment, for example, 
env-abc123. - Stream
Governance GetEnvironment Stream Governance  
- display
Name String A human-readable name for the Environment.
Note: Exactly one from the
idanddisplay_nameattributes must be specified.- id String
 - The ID of the Environment, for example, 
env-abc123. - stream
Governance GetEnvironment Stream Governance  
- display
Name string A human-readable name for the Environment.
Note: Exactly one from the
idanddisplay_nameattributes must be specified.- id string
 - The ID of the Environment, for example, 
env-abc123. - stream
Governance GetEnvironment Stream Governance  
- display_
name str A human-readable name for the Environment.
Note: Exactly one from the
idanddisplay_nameattributes must be specified.- id str
 - The ID of the Environment, for example, 
env-abc123. - stream_
governance GetEnvironment Stream Governance  
- display
Name String A human-readable name for the Environment.
Note: Exactly one from the
idanddisplay_nameattributes must be specified.- id String
 - The ID of the Environment, for example, 
env-abc123. - stream
Governance Property Map 
getEnvironment Result
The following output properties are available:
- Display
Name string - (Required String) A human-readable name for the Environment.
 - Id string
 - (Required String) The ID of the Environment, for example, 
env-abc123. - Resource
Name string - (Required String) The Confluent Resource Name of the Environment, for example, 
crn://confluent.cloud/organization=1111aaaa-11aa-11aa-11aa-111111aaaaaa/environment=env-abc123. - Stream
Governance Pulumi.Confluent Cloud. Outputs. Get Environment Stream Governance  
- Display
Name string - (Required String) A human-readable name for the Environment.
 - Id string
 - (Required String) The ID of the Environment, for example, 
env-abc123. - Resource
Name string - (Required String) The Confluent Resource Name of the Environment, for example, 
crn://confluent.cloud/organization=1111aaaa-11aa-11aa-11aa-111111aaaaaa/environment=env-abc123. - Stream
Governance GetEnvironment Stream Governance  
- display
Name String - (Required String) A human-readable name for the Environment.
 - id String
 - (Required String) The ID of the Environment, for example, 
env-abc123. - resource
Name String - (Required String) The Confluent Resource Name of the Environment, for example, 
crn://confluent.cloud/organization=1111aaaa-11aa-11aa-11aa-111111aaaaaa/environment=env-abc123. - stream
Governance GetEnvironment Stream Governance  
- display
Name string - (Required String) A human-readable name for the Environment.
 - id string
 - (Required String) The ID of the Environment, for example, 
env-abc123. - resource
Name string - (Required String) The Confluent Resource Name of the Environment, for example, 
crn://confluent.cloud/organization=1111aaaa-11aa-11aa-11aa-111111aaaaaa/environment=env-abc123. - stream
Governance GetEnvironment Stream Governance  
- display_
name str - (Required String) A human-readable name for the Environment.
 - id str
 - (Required String) The ID of the Environment, for example, 
env-abc123. - resource_
name str - (Required String) The Confluent Resource Name of the Environment, for example, 
crn://confluent.cloud/organization=1111aaaa-11aa-11aa-11aa-111111aaaaaa/environment=env-abc123. - stream_
governance GetEnvironment Stream Governance  
- display
Name String - (Required String) A human-readable name for the Environment.
 - id String
 - (Required String) The ID of the Environment, for example, 
env-abc123. - resource
Name String - (Required String) The Confluent Resource Name of the Environment, for example, 
crn://confluent.cloud/organization=1111aaaa-11aa-11aa-11aa-111111aaaaaa/environment=env-abc123. - stream
Governance Property Map 
Supporting Types
GetEnvironmentStreamGovernance   
- Package string
 - Stream Governance Package. 'ESSENTIALS' or 'ADVANCED'
 
- Package string
 - Stream Governance Package. 'ESSENTIALS' or 'ADVANCED'
 
- package_ String
 - Stream Governance Package. 'ESSENTIALS' or 'ADVANCED'
 
- package string
 - Stream Governance Package. 'ESSENTIALS' or 'ADVANCED'
 
- package str
 - Stream Governance Package. 'ESSENTIALS' or 'ADVANCED'
 
- package String
 - Stream Governance Package. 'ESSENTIALS' or 'ADVANCED'
 
Package Details
- Repository
 - Confluent Cloud pulumi/pulumi-confluentcloud
 - License
 - Apache-2.0
 - Notes
 - This Pulumi package is based on the 
confluentTerraform Provider.