Workspace class

Provides a workspace in AWS Workspaces Service

> NOTE: AWS WorkSpaces service requires workspaces_DefaultRole IAM role to operate normally.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const valueWindows10 = aws.workspaces.getBundle({
    bundleId: "wsb-bh8rsxt14",
});
const workspaces = aws.kms.getKey({
    keyId: "alias/aws/workspaces",
});
const example = new aws.workspaces.Workspace("example", {
    workspaceProperties: {
        computeTypeName: "VALUE",
        userVolumeSizeGib: 10,
        rootVolumeSizeGib: 80,
        runningMode: "AUTO_STOP",
        runningModeAutoStopTimeoutInMinutes: 60,
    },
    directoryId: exampleAwsWorkspacesDirectory.id,
    bundleId: valueWindows10.then(valueWindows10 => valueWindows10.id),
    userName: "john.doe",
    rootVolumeEncryptionEnabled: true,
    userVolumeEncryptionEnabled: true,
    volumeEncryptionKey: workspaces.then(workspaces => workspaces.arn),
    tags: {
        Department: "IT",
    },
});
import pulumi
import pulumi_aws as aws

value_windows10 = aws.workspaces.get_bundle(bundle_id="wsb-bh8rsxt14")
workspaces = aws.kms.get_key(key_id="alias/aws/workspaces")
example = aws.workspaces.Workspace("example",
    workspace_properties={
        "compute_type_name": "VALUE",
        "user_volume_size_gib": 10,
        "root_volume_size_gib": 80,
        "running_mode": "AUTO_STOP",
        "running_mode_auto_stop_timeout_in_minutes": 60,
    },
    directory_id=example_aws_workspaces_directory["id"],
    bundle_id=value_windows10.id,
    user_name="john.doe",
    root_volume_encryption_enabled=True,
    user_volume_encryption_enabled=True,
    volume_encryption_key=workspaces.arn,
    tags={
        "Department": "IT",
    })
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var valueWindows10 = Aws.Workspaces.GetBundle.Invoke(new()
    {
        BundleId = "wsb-bh8rsxt14",
    });

    var workspaces = Aws.Kms.GetKey.Invoke(new()
    {
        KeyId = "alias/aws/workspaces",
    });

    var example = new Aws.Workspaces.Workspace("example", new()
    {
        WorkspaceProperties = new Aws.Workspaces.Inputs.WorkspaceWorkspacePropertiesArgs
        {
            ComputeTypeName = "VALUE",
            UserVolumeSizeGib = 10,
            RootVolumeSizeGib = 80,
            RunningMode = "AUTO_STOP",
            RunningModeAutoStopTimeoutInMinutes = 60,
        },
        DirectoryId = exampleAwsWorkspacesDirectory.Id,
        BundleId = valueWindows10.Apply(getBundleResult => getBundleResult.Id),
        UserName = "john.doe",
        RootVolumeEncryptionEnabled = true,
        UserVolumeEncryptionEnabled = true,
        VolumeEncryptionKey = workspaces.Apply(getKeyResult => getKeyResult.Arn),
        Tags =
        {
            { "Department", "IT" },
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/kms"
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/workspaces"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		valueWindows10, err := workspaces.GetBundle(ctx, &workspaces.GetBundleArgs{
			BundleId: pulumi.StringRef("wsb-bh8rsxt14"),
		}, nil)
		if err != nil {
			return err
		}
		workspaces2, err := kms.LookupKey(ctx, &kms.LookupKeyArgs{
			KeyId: "alias/aws/workspaces",
		}, nil)
		if err != nil {
			return err
		}
		_, err = workspaces.NewWorkspace(ctx, "example", &workspaces.WorkspaceArgs{
			WorkspaceProperties: &workspaces.WorkspaceWorkspacePropertiesArgs{
				ComputeTypeName:                     pulumi.String("VALUE"),
				UserVolumeSizeGib:                   pulumi.Int(10),
				RootVolumeSizeGib:                   pulumi.Int(80),
				RunningMode:                         pulumi.String("AUTO_STOP"),
				RunningModeAutoStopTimeoutInMinutes: pulumi.Int(60),
			},
			DirectoryId:                 pulumi.Any(exampleAwsWorkspacesDirectory.Id),
			BundleId:                    pulumi.String(valueWindows10.Id),
			UserName:                    pulumi.String("john.doe"),
			RootVolumeEncryptionEnabled: pulumi.Bool(true),
			UserVolumeEncryptionEnabled: pulumi.Bool(true),
			VolumeEncryptionKey:         pulumi.String(workspaces2.Arn),
			Tags: pulumi.StringMap{
				"Department": pulumi.String("IT"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

data "aws_workspaces_getbundle" "valueWindows10" {
  bundle_id = "wsb-bh8rsxt14"
}
data "aws_kms_getkey" "workspaces" {
  key_id = "alias/aws/workspaces"
}

resource "aws_workspaces_workspace" "example" {
  workspace_properties = {
    compute_type_name                         = "VALUE"
    user_volume_size_gib                      = 10
    root_volume_size_gib                      = 80
    running_mode                              = "AUTO_STOP"
    running_mode_auto_stop_timeout_in_minutes = 60
  }
  directory_id                   = exampleAwsWorkspacesDirectory.id
  bundle_id                      = data.aws_workspaces_getbundle.valueWindows10.id
  user_name                      = "john.doe"
  root_volume_encryption_enabled = true
  user_volume_encryption_enabled = true
  volume_encryption_key          = data.aws_kms_getkey.workspaces.arn
  tags = {
    "Department" = "IT"
  }
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.workspaces.WorkspacesFunctions;
import com.pulumi.aws.workspaces.inputs.GetBundleArgs;
import com.pulumi.aws.kms.KmsFunctions;
import com.pulumi.aws.kms.inputs.GetKeyArgs;
import com.pulumi.aws.workspaces.Workspace;
import com.pulumi.aws.workspaces.WorkspaceArgs;
import com.pulumi.aws.workspaces.inputs.WorkspaceWorkspacePropertiesArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 valueWindows10 = WorkspacesFunctions.getBundle(GetBundleArgs.builder()
            .bundleId("wsb-bh8rsxt14")
            .build());

        final var workspaces = KmsFunctions.getKey(GetKeyArgs.builder()
            .keyId("alias/aws/workspaces")
            .build());

        var example = new Workspace("example", WorkspaceArgs.builder()
            .workspaceProperties(WorkspaceWorkspacePropertiesArgs.builder()
                .computeTypeName("VALUE")
                .userVolumeSizeGib(10)
                .rootVolumeSizeGib(80)
                .runningMode("AUTO_STOP")
                .runningModeAutoStopTimeoutInMinutes(60)
                .build())
            .directoryId(exampleAwsWorkspacesDirectory.id())
            .bundleId(valueWindows10.id())
            .userName("john.doe")
            .rootVolumeEncryptionEnabled(true)
            .userVolumeEncryptionEnabled(true)
            .volumeEncryptionKey(workspaces.arn())
            .tags(Map.of("Department", "IT"))
            .build());

    }
}
resources:
  example:
    type: aws:workspaces:Workspace
    properties:
      workspaceProperties:
        computeTypeName: VALUE
        userVolumeSizeGib: 10
        rootVolumeSizeGib: 80
        runningMode: AUTO_STOP
        runningModeAutoStopTimeoutInMinutes: 60
      directoryId: ${exampleAwsWorkspacesDirectory.id}
      bundleId: ${valueWindows10.id}
      userName: john.doe
      rootVolumeEncryptionEnabled: true
      userVolumeEncryptionEnabled: true
      volumeEncryptionKey: ${workspaces.arn}
      tags:
        Department: IT
variables:
  valueWindows10:
    fn::invoke:
      function: aws:workspaces:getBundle
      arguments:
        bundleId: wsb-bh8rsxt14
  workspaces:
    fn::invoke:
      function: aws:kms:getKey
      arguments:
        keyId: alias/aws/workspaces

Import

Using pulumi import, import Workspaces using their ID. For example:

$ pulumi import aws:workspaces/workspace:Workspace example ws-9z9zmbkhv

Constructors

Workspace(String name, {WorkspaceArgs? args, CustomResourceOptions? options})
Creates a new Workspace. name The Pulumi resource name. args Arguments used to configure this Workspace. The set of arguments for Workspace. options Resource options controlling this resource's behavior.
Workspace.reference(String urn)
Creates a typed reference to an existing Workspace resource.

Properties

bundleId ↔ Output<String>
The ID of the bundle for the WorkSpace.
latefinal
childResources Set<Resource>
finalinherited
completionSources Map<String, IOutputCompletionSource>
latefinalinherited
computerName ↔ Output<String>
The name of the WorkSpace, as seen by the operating system.
latefinal
directoryId ↔ Output<String>
The ID of the directory for the WorkSpace.
latefinal
hashCode int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
ipAddress ↔ Output<String>
The IP address of the WorkSpace.
latefinal
isCustom bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference bool
Whether this instance represents a resource value returned over RPC.
finalinherited
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
resourceTransforms List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
rootVolumeEncryptionEnabled ↔ Output<bool?>
Indicates whether the data stored on the root volume is encrypted.
latefinal
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state ↔ Output<String>
The operational state of the WorkSpace.
latefinal
tags ↔ Output<Map<String, String>?>
The tags for the WorkSpace. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
latefinal
tagsAll ↔ Output<Map<String, String>>
A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
latefinal
transformations List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited
userName ↔ Output<String>
The user name of the user for the WorkSpace. This user name must exist in the directory for the WorkSpace.
latefinal
userVolumeEncryptionEnabled ↔ Output<bool?>
Indicates whether the data stored on the user volume is encrypted.
latefinal
volumeEncryptionKey ↔ Output<String?>
The ARN of a symmetric AWS KMS customer master key (CMK) used to encrypt data stored on your WorkSpace. Amazon WorkSpaces does not support asymmetric CMKs.
latefinal
workspaceProperties ↔ Output<WorkspaceWorkspaceProperties>
The WorkSpace properties.
latefinal

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() String
Returns this resource's logical name.
inherited
getResourceType() String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {WorkspaceState? state, CustomResourceOptions? options}) Workspace
Gets an existing Workspace resource's state with the given name and id.