aws.workspacesweb.NetworkSettingsAssociation
Explore with Pulumi AI
Resource for managing an AWS WorkSpaces Web Network Settings Association.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import * as std from "@pulumi/std";
const available = aws.getAvailabilityZones({
state: "available",
filters: [{
name: "opt-in-status",
values: ["opt-in-not-required"],
}],
});
const example = new aws.ec2.Vpc("example", {
cidrBlock: "10.0.0.0/16",
tags: {
Name: "example",
},
});
const exampleSubnet: aws.ec2.Subnet[] = [];
for (const range = {value: 0}; range.value < 2; range.value++) {
exampleSubnet.push(new aws.ec2.Subnet(`example-${range.value}`, {
vpcId: example.id,
cidrBlock: example.cidrBlock.apply(cidrBlock => std.cidrsubnetOutput({
input: cidrBlock,
newbits: 8,
netnum: range.value,
})).apply(invoke => invoke.result),
availabilityZone: available.then(available => available.names[range.value]),
tags: {
Name: "example",
},
}));
}
const exampleSecurityGroup: aws.ec2.SecurityGroup[] = [];
for (const range = {value: 0}; range.value < 2; range.value++) {
exampleSecurityGroup.push(new aws.ec2.SecurityGroup(`example-${range.value}`, {
vpcId: example.id,
name: `example-${range.value}`,
tags: {
Name: "example",
},
}));
}
const examplePortal = new aws.workspacesweb.Portal("example", {displayName: "example"});
const exampleNetworkSettings = new aws.workspacesweb.NetworkSettings("example", {
vpcId: example.id,
subnetIds: [
exampleSubnet[0].id,
exampleSubnet[1].id,
],
securityGroupIds: [
exampleSecurityGroup[0].id,
exampleSecurityGroup[1].id,
],
});
const exampleNetworkSettingsAssociation = new aws.workspacesweb.NetworkSettingsAssociation("example", {
networkSettingsArn: exampleNetworkSettings.networkSettingsArn,
portalArn: examplePortal.portalArn,
});
import pulumi
import pulumi_aws as aws
import pulumi_std as std
available = aws.get_availability_zones(state="available",
filters=[{
"name": "opt-in-status",
"values": ["opt-in-not-required"],
}])
example = aws.ec2.Vpc("example",
cidr_block="10.0.0.0/16",
tags={
"Name": "example",
})
example_subnet = []
for range in [{"value": i} for i in range(0, 2)]:
example_subnet.append(aws.ec2.Subnet(f"example-{range['value']}",
vpc_id=example.id,
cidr_block=example.cidr_block.apply(lambda cidr_block: std.cidrsubnet_output(input=cidr_block,
newbits=8,
netnum=range["value"])).apply(lambda invoke: invoke.result),
availability_zone=available.names[range["value"]],
tags={
"Name": "example",
}))
example_security_group = []
for range in [{"value": i} for i in range(0, 2)]:
example_security_group.append(aws.ec2.SecurityGroup(f"example-{range['value']}",
vpc_id=example.id,
name=f"example-{range['value']}",
tags={
"Name": "example",
}))
example_portal = aws.workspacesweb.Portal("example", display_name="example")
example_network_settings = aws.workspacesweb.NetworkSettings("example",
vpc_id=example.id,
subnet_ids=[
example_subnet[0].id,
example_subnet[1].id,
],
security_group_ids=[
example_security_group[0].id,
example_security_group[1].id,
])
example_network_settings_association = aws.workspacesweb.NetworkSettingsAssociation("example",
network_settings_arn=example_network_settings.network_settings_arn,
portal_arn=example_portal.portal_arn)
package main
import (
"fmt"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/ec2"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/workspacesweb"
"github.com/pulumi/pulumi-std/sdk/go/std"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
available, err := aws.GetAvailabilityZones(ctx, &aws.GetAvailabilityZonesArgs{
State: pulumi.StringRef("available"),
Filters: []aws.GetAvailabilityZonesFilter{
{
Name: "opt-in-status",
Values: []string{
"opt-in-not-required",
},
},
},
}, nil)
if err != nil {
return err
}
example, err := ec2.NewVpc(ctx, "example", &ec2.VpcArgs{
CidrBlock: pulumi.String("10.0.0.0/16"),
Tags: pulumi.StringMap{
"Name": pulumi.String("example"),
},
})
if err != nil {
return err
}
var exampleSubnet []*ec2.Subnet
for index := 0; index < 2; index++ {
key0 := index
val0 := index
__res, err := ec2.NewSubnet(ctx, fmt.Sprintf("example-%v", key0), &ec2.SubnetArgs{
VpcId: example.ID(),
CidrBlock: pulumi.String(example.CidrBlock.ApplyT(func(cidrBlock string) (std.CidrsubnetResult, error) {
return std.CidrsubnetResult(interface{}(std.CidrsubnetOutput(ctx, std.CidrsubnetOutputArgs{
Input: cidrBlock,
Newbits: 8,
Netnum: val0,
}, nil))), nil
}).(std.CidrsubnetResultOutput).ApplyT(func(invoke std.CidrsubnetResult) (*string, error) {
return invoke.Result, nil
}).(pulumi.StringPtrOutput)),
AvailabilityZone: pulumi.String(available.Names[val0]),
Tags: pulumi.StringMap{
"Name": pulumi.String("example"),
},
})
if err != nil {
return err
}
exampleSubnet = append(exampleSubnet, __res)
}
var exampleSecurityGroup []*ec2.SecurityGroup
for index := 0; index < 2; index++ {
key0 := index
val0 := index
__res, err := ec2.NewSecurityGroup(ctx, fmt.Sprintf("example-%v", key0), &ec2.SecurityGroupArgs{
VpcId: example.ID(),
Name: pulumi.Sprintf("example-%v", val0),
Tags: pulumi.StringMap{
"Name": pulumi.String("example"),
},
})
if err != nil {
return err
}
exampleSecurityGroup = append(exampleSecurityGroup, __res)
}
examplePortal, err := workspacesweb.NewPortal(ctx, "example", &workspacesweb.PortalArgs{
DisplayName: pulumi.String("example"),
})
if err != nil {
return err
}
exampleNetworkSettings, err := workspacesweb.NewNetworkSettings(ctx, "example", &workspacesweb.NetworkSettingsArgs{
VpcId: example.ID(),
SubnetIds: pulumi.StringArray{
exampleSubnet[0].ID(),
exampleSubnet[1].ID(),
},
SecurityGroupIds: pulumi.StringArray{
exampleSecurityGroup[0].ID(),
exampleSecurityGroup[1].ID(),
},
})
if err != nil {
return err
}
_, err = workspacesweb.NewNetworkSettingsAssociation(ctx, "example", &workspacesweb.NetworkSettingsAssociationArgs{
NetworkSettingsArn: exampleNetworkSettings.NetworkSettingsArn,
PortalArn: examplePortal.PortalArn,
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
using Std = Pulumi.Std;
return await Deployment.RunAsync(() =>
{
var available = Aws.GetAvailabilityZones.Invoke(new()
{
State = "available",
Filters = new[]
{
new Aws.Inputs.GetAvailabilityZonesFilterInputArgs
{
Name = "opt-in-status",
Values = new[]
{
"opt-in-not-required",
},
},
},
});
var example = new Aws.Ec2.Vpc("example", new()
{
CidrBlock = "10.0.0.0/16",
Tags =
{
{ "Name", "example" },
},
});
var exampleSubnet = new List<Aws.Ec2.Subnet>();
for (var rangeIndex = 0; rangeIndex < 2; rangeIndex++)
{
var range = new { Value = rangeIndex };
exampleSubnet.Add(new Aws.Ec2.Subnet($"example-{range.Value}", new()
{
VpcId = example.Id,
CidrBlock = example.CidrBlock.Apply(cidrBlock => Std.Cidrsubnet.Invoke(new()
{
Input = cidrBlock,
Newbits = 8,
Netnum = range.Value,
})).Apply(invoke => invoke.Result),
AvailabilityZone = available.Apply(getAvailabilityZonesResult => getAvailabilityZonesResult.Names)[range.Value],
Tags =
{
{ "Name", "example" },
},
}));
}
var exampleSecurityGroup = new List<Aws.Ec2.SecurityGroup>();
for (var rangeIndex = 0; rangeIndex < 2; rangeIndex++)
{
var range = new { Value = rangeIndex };
exampleSecurityGroup.Add(new Aws.Ec2.SecurityGroup($"example-{range.Value}", new()
{
VpcId = example.Id,
Name = $"example-{range.Value}",
Tags =
{
{ "Name", "example" },
},
}));
}
var examplePortal = new Aws.WorkSpacesWeb.Portal("example", new()
{
DisplayName = "example",
});
var exampleNetworkSettings = new Aws.WorkSpacesWeb.NetworkSettings("example", new()
{
VpcId = example.Id,
SubnetIds = new[]
{
exampleSubnet[0].Id,
exampleSubnet[1].Id,
},
SecurityGroupIds = new[]
{
exampleSecurityGroup[0].Id,
exampleSecurityGroup[1].Id,
},
});
var exampleNetworkSettingsAssociation = new Aws.WorkSpacesWeb.NetworkSettingsAssociation("example", new()
{
NetworkSettingsArn = exampleNetworkSettings.NetworkSettingsArn,
PortalArn = examplePortal.PortalArn,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.AwsFunctions;
import com.pulumi.aws.inputs.GetAvailabilityZonesArgs;
import com.pulumi.aws.ec2.Vpc;
import com.pulumi.aws.ec2.VpcArgs;
import com.pulumi.aws.ec2.Subnet;
import com.pulumi.aws.ec2.SubnetArgs;
import com.pulumi.std.StdFunctions;
import com.pulumi.std.inputs.CidrsubnetArgs;
import com.pulumi.aws.ec2.SecurityGroup;
import com.pulumi.aws.ec2.SecurityGroupArgs;
import com.pulumi.aws.workspacesweb.Portal;
import com.pulumi.aws.workspacesweb.PortalArgs;
import com.pulumi.aws.workspacesweb.NetworkSettings;
import com.pulumi.aws.workspacesweb.NetworkSettingsArgs;
import com.pulumi.aws.workspacesweb.NetworkSettingsAssociation;
import com.pulumi.aws.workspacesweb.NetworkSettingsAssociationArgs;
import com.pulumi.codegen.internal.KeyedValue;
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 available = AwsFunctions.getAvailabilityZones(GetAvailabilityZonesArgs.builder()
.state("available")
.filters(GetAvailabilityZonesFilterArgs.builder()
.name("opt-in-status")
.values("opt-in-not-required")
.build())
.build());
var example = new Vpc("example", VpcArgs.builder()
.cidrBlock("10.0.0.0/16")
.tags(Map.of("Name", "example"))
.build());
for (var i = 0; i < 2; i++) {
new Subnet("exampleSubnet-" + i, SubnetArgs.builder()
.vpcId(example.id())
.cidrBlock(example.cidrBlock().applyValue(_cidrBlock -> StdFunctions.cidrsubnet(CidrsubnetArgs.builder()
.input(_cidrBlock)
.newbits(8)
.netnum(range.value())
.build())).applyValue(_invoke -> _invoke.result()))
.availabilityZone(available.names()[range.value()])
.tags(Map.of("Name", "example"))
.build());
}
for (var i = 0; i < 2; i++) {
new SecurityGroup("exampleSecurityGroup-" + i, SecurityGroupArgs.builder()
.vpcId(example.id())
.name(String.format("example-%s", range.value()))
.tags(Map.of("Name", "example"))
.build());
}
var examplePortal = new Portal("examplePortal", PortalArgs.builder()
.displayName("example")
.build());
var exampleNetworkSettings = new NetworkSettings("exampleNetworkSettings", NetworkSettingsArgs.builder()
.vpcId(example.id())
.subnetIds(
exampleSubnet[0].id(),
exampleSubnet[1].id())
.securityGroupIds(
exampleSecurityGroup[0].id(),
exampleSecurityGroup[1].id())
.build());
var exampleNetworkSettingsAssociation = new NetworkSettingsAssociation("exampleNetworkSettingsAssociation", NetworkSettingsAssociationArgs.builder()
.networkSettingsArn(exampleNetworkSettings.networkSettingsArn())
.portalArn(examplePortal.portalArn())
.build());
}
}
Example coming soon!
Create NetworkSettingsAssociation Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new NetworkSettingsAssociation(name: string, args: NetworkSettingsAssociationArgs, opts?: CustomResourceOptions);
@overload
def NetworkSettingsAssociation(resource_name: str,
args: NetworkSettingsAssociationArgs,
opts: Optional[ResourceOptions] = None)
@overload
def NetworkSettingsAssociation(resource_name: str,
opts: Optional[ResourceOptions] = None,
network_settings_arn: Optional[str] = None,
portal_arn: Optional[str] = None,
region: Optional[str] = None)
func NewNetworkSettingsAssociation(ctx *Context, name string, args NetworkSettingsAssociationArgs, opts ...ResourceOption) (*NetworkSettingsAssociation, error)
public NetworkSettingsAssociation(string name, NetworkSettingsAssociationArgs args, CustomResourceOptions? opts = null)
public NetworkSettingsAssociation(String name, NetworkSettingsAssociationArgs args)
public NetworkSettingsAssociation(String name, NetworkSettingsAssociationArgs args, CustomResourceOptions options)
type: aws:workspacesweb:NetworkSettingsAssociation
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 NetworkSettingsAssociationArgs
- 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 NetworkSettingsAssociationArgs
- 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 NetworkSettingsAssociationArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args NetworkSettingsAssociationArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args NetworkSettingsAssociationArgs
- 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 networkSettingsAssociationResource = new Aws.WorkSpacesWeb.NetworkSettingsAssociation("networkSettingsAssociationResource", new()
{
NetworkSettingsArn = "string",
PortalArn = "string",
Region = "string",
});
example, err := workspacesweb.NewNetworkSettingsAssociation(ctx, "networkSettingsAssociationResource", &workspacesweb.NetworkSettingsAssociationArgs{
NetworkSettingsArn: pulumi.String("string"),
PortalArn: pulumi.String("string"),
Region: pulumi.String("string"),
})
var networkSettingsAssociationResource = new NetworkSettingsAssociation("networkSettingsAssociationResource", NetworkSettingsAssociationArgs.builder()
.networkSettingsArn("string")
.portalArn("string")
.region("string")
.build());
network_settings_association_resource = aws.workspacesweb.NetworkSettingsAssociation("networkSettingsAssociationResource",
network_settings_arn="string",
portal_arn="string",
region="string")
const networkSettingsAssociationResource = new aws.workspacesweb.NetworkSettingsAssociation("networkSettingsAssociationResource", {
networkSettingsArn: "string",
portalArn: "string",
region: "string",
});
type: aws:workspacesweb:NetworkSettingsAssociation
properties:
networkSettingsArn: string
portalArn: string
region: string
NetworkSettingsAssociation Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The NetworkSettingsAssociation resource accepts the following input properties:
- Network
Settings stringArn - ARN of the network settings to associate with the portal. Forces replacement if changed.
- Portal
Arn string ARN of the portal to associate with the network settings. Forces replacement if changed.
The following arguments are optional:
- Region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- Network
Settings stringArn - ARN of the network settings to associate with the portal. Forces replacement if changed.
- Portal
Arn string ARN of the portal to associate with the network settings. Forces replacement if changed.
The following arguments are optional:
- Region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- network
Settings StringArn - ARN of the network settings to associate with the portal. Forces replacement if changed.
- portal
Arn String ARN of the portal to associate with the network settings. Forces replacement if changed.
The following arguments are optional:
- region String
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- network
Settings stringArn - ARN of the network settings to associate with the portal. Forces replacement if changed.
- portal
Arn string ARN of the portal to associate with the network settings. Forces replacement if changed.
The following arguments are optional:
- region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- network_
settings_ strarn - ARN of the network settings to associate with the portal. Forces replacement if changed.
- portal_
arn str ARN of the portal to associate with the network settings. Forces replacement if changed.
The following arguments are optional:
- region str
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- network
Settings StringArn - ARN of the network settings to associate with the portal. Forces replacement if changed.
- portal
Arn String ARN of the portal to associate with the network settings. Forces replacement if changed.
The following arguments are optional:
- region String
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
Outputs
All input properties are implicitly available as output properties. Additionally, the NetworkSettingsAssociation 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 NetworkSettingsAssociation Resource
Get an existing NetworkSettingsAssociation 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?: NetworkSettingsAssociationState, opts?: CustomResourceOptions): NetworkSettingsAssociation
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
network_settings_arn: Optional[str] = None,
portal_arn: Optional[str] = None,
region: Optional[str] = None) -> NetworkSettingsAssociation
func GetNetworkSettingsAssociation(ctx *Context, name string, id IDInput, state *NetworkSettingsAssociationState, opts ...ResourceOption) (*NetworkSettingsAssociation, error)
public static NetworkSettingsAssociation Get(string name, Input<string> id, NetworkSettingsAssociationState? state, CustomResourceOptions? opts = null)
public static NetworkSettingsAssociation get(String name, Output<String> id, NetworkSettingsAssociationState state, CustomResourceOptions options)
resources: _: type: aws:workspacesweb:NetworkSettingsAssociation get: id: ${id}
- 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.
- Network
Settings stringArn - ARN of the network settings to associate with the portal. Forces replacement if changed.
- Portal
Arn string ARN of the portal to associate with the network settings. Forces replacement if changed.
The following arguments are optional:
- Region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- Network
Settings stringArn - ARN of the network settings to associate with the portal. Forces replacement if changed.
- Portal
Arn string ARN of the portal to associate with the network settings. Forces replacement if changed.
The following arguments are optional:
- Region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- network
Settings StringArn - ARN of the network settings to associate with the portal. Forces replacement if changed.
- portal
Arn String ARN of the portal to associate with the network settings. Forces replacement if changed.
The following arguments are optional:
- region String
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- network
Settings stringArn - ARN of the network settings to associate with the portal. Forces replacement if changed.
- portal
Arn string ARN of the portal to associate with the network settings. Forces replacement if changed.
The following arguments are optional:
- region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- network_
settings_ strarn - ARN of the network settings to associate with the portal. Forces replacement if changed.
- portal_
arn str ARN of the portal to associate with the network settings. Forces replacement if changed.
The following arguments are optional:
- region str
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- network
Settings StringArn - ARN of the network settings to associate with the portal. Forces replacement if changed.
- portal
Arn String ARN of the portal to associate with the network settings. Forces replacement if changed.
The following arguments are optional:
- region String
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
aws
Terraform Provider.