published on Tuesday, Mar 10, 2026 by Pulumi
published on Tuesday, Mar 10, 2026 by Pulumi
Provides a Core Network Policy Attachment resource. This puts a Core Network Policy to an existing Core Network and executes the change set, which deploys changes globally based on the policy submitted (Sets the policy to LIVE).
NOTE on Core Networks and Policy Attachments: For a given policy attachment, this resource is incompatible with using the
aws.networkmanager.CoreNetworkresourcepolicy_documentargument. When using that argument and this resource, both will attempt to manage the core network’s policy document and Pulumi will show a permanent difference.
NOTE: Deleting this resource will not delete the current policy defined in this resource. Deleting this resource will also not revert the current
LIVEpolicy to the previous version.
Example Usage
Basic
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var exampleCoreNetwork = new Aws.NetworkManager.CoreNetwork("exampleCoreNetwork", new()
{
GlobalNetworkId = aws_networkmanager_global_network.Example.Id,
});
var exampleCoreNetworkPolicyAttachment = new Aws.NetworkManager.CoreNetworkPolicyAttachment("exampleCoreNetworkPolicyAttachment", new()
{
CoreNetworkId = exampleCoreNetwork.Id,
PolicyDocument = data.Aws_networkmanager_core_network_policy_document.Example.Json,
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/networkmanager"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleCoreNetwork, err := networkmanager.NewCoreNetwork(ctx, "exampleCoreNetwork", &networkmanager.CoreNetworkArgs{
GlobalNetworkId: pulumi.Any(aws_networkmanager_global_network.Example.Id),
})
if err != nil {
return err
}
_, err = networkmanager.NewCoreNetworkPolicyAttachment(ctx, "exampleCoreNetworkPolicyAttachment", &networkmanager.CoreNetworkPolicyAttachmentArgs{
CoreNetworkId: exampleCoreNetwork.ID(),
PolicyDocument: pulumi.Any(data.Aws_networkmanager_core_network_policy_document.Example.Json),
})
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.aws.networkmanager.CoreNetwork;
import com.pulumi.aws.networkmanager.CoreNetworkArgs;
import com.pulumi.aws.networkmanager.CoreNetworkPolicyAttachment;
import com.pulumi.aws.networkmanager.CoreNetworkPolicyAttachmentArgs;
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 exampleCoreNetwork = new CoreNetwork("exampleCoreNetwork", CoreNetworkArgs.builder()
.globalNetworkId(aws_networkmanager_global_network.example().id())
.build());
var exampleCoreNetworkPolicyAttachment = new CoreNetworkPolicyAttachment("exampleCoreNetworkPolicyAttachment", CoreNetworkPolicyAttachmentArgs.builder()
.coreNetworkId(exampleCoreNetwork.id())
.policyDocument(data.aws_networkmanager_core_network_policy_document().example().json())
.build());
}
}
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const exampleCoreNetwork = new aws.networkmanager.CoreNetwork("exampleCoreNetwork", {globalNetworkId: aws_networkmanager_global_network.example.id});
const exampleCoreNetworkPolicyAttachment = new aws.networkmanager.CoreNetworkPolicyAttachment("exampleCoreNetworkPolicyAttachment", {
coreNetworkId: exampleCoreNetwork.id,
policyDocument: data.aws_networkmanager_core_network_policy_document.example.json,
});
import pulumi
import pulumi_aws as aws
example_core_network = aws.networkmanager.CoreNetwork("exampleCoreNetwork", global_network_id=aws_networkmanager_global_network["example"]["id"])
example_core_network_policy_attachment = aws.networkmanager.CoreNetworkPolicyAttachment("exampleCoreNetworkPolicyAttachment",
core_network_id=example_core_network.id,
policy_document=data["aws_networkmanager_core_network_policy_document"]["example"]["json"])
resources:
exampleCoreNetwork:
type: aws:networkmanager:CoreNetwork
properties:
globalNetworkId: ${aws_networkmanager_global_network.example.id}
exampleCoreNetworkPolicyAttachment:
type: aws:networkmanager:CoreNetworkPolicyAttachment
properties:
coreNetworkId: ${exampleCoreNetwork.id}
policyDocument: ${data.aws_networkmanager_core_network_policy_document.example.json}
With VPC Attachment (Single Region)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var exampleGlobalNetwork = new Aws.NetworkManager.GlobalNetwork("exampleGlobalNetwork");
var exampleCoreNetwork = new Aws.NetworkManager.CoreNetwork("exampleCoreNetwork", new()
{
GlobalNetworkId = exampleGlobalNetwork.Id,
CreateBasePolicy = true,
});
var exampleVpcAttachment = new Aws.NetworkManager.VpcAttachment("exampleVpcAttachment", new()
{
CoreNetworkId = exampleCoreNetwork.Id,
SubnetArns = aws_subnet.Example.Select(__item => __item.Arn).ToList(),
VpcArn = aws_vpc.Example.Arn,
});
var exampleCoreNetworkPolicyDocument = Aws.NetworkManager.GetCoreNetworkPolicyDocument.Invoke(new()
{
CoreNetworkConfigurations = new[]
{
new Aws.NetworkManager.Inputs.GetCoreNetworkPolicyDocumentCoreNetworkConfigurationInputArgs
{
AsnRanges = new[]
{
"65022-65534",
},
EdgeLocations = new[]
{
new Aws.NetworkManager.Inputs.GetCoreNetworkPolicyDocumentCoreNetworkConfigurationEdgeLocationInputArgs
{
Location = "us-west-2",
},
},
},
},
Segments = new[]
{
new Aws.NetworkManager.Inputs.GetCoreNetworkPolicyDocumentSegmentInputArgs
{
Name = "segment",
},
},
SegmentActions = new[]
{
new Aws.NetworkManager.Inputs.GetCoreNetworkPolicyDocumentSegmentActionInputArgs
{
Action = "create-route",
Segment = "segment",
DestinationCidrBlocks = new[]
{
"0.0.0.0/0",
},
Destinations = new[]
{
exampleVpcAttachment.Id,
},
},
},
});
var exampleCoreNetworkPolicyAttachment = new Aws.NetworkManager.CoreNetworkPolicyAttachment("exampleCoreNetworkPolicyAttachment", new()
{
CoreNetworkId = exampleCoreNetwork.Id,
PolicyDocument = exampleCoreNetworkPolicyDocument.Apply(getCoreNetworkPolicyDocumentResult => getCoreNetworkPolicyDocumentResult.Json),
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/networkmanager"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleGlobalNetwork, err := networkmanager.NewGlobalNetwork(ctx, "exampleGlobalNetwork", nil)
if err != nil {
return err
}
exampleCoreNetwork, err := networkmanager.NewCoreNetwork(ctx, "exampleCoreNetwork", &networkmanager.CoreNetworkArgs{
GlobalNetworkId: exampleGlobalNetwork.ID(),
CreateBasePolicy: pulumi.Bool(true),
})
if err != nil {
return err
}
var splat0 []interface{}
for _, val0 := range aws_subnet.Example {
splat0 = append(splat0, val0.Arn)
}
exampleVpcAttachment, err := networkmanager.NewVpcAttachment(ctx, "exampleVpcAttachment", &networkmanager.VpcAttachmentArgs{
CoreNetworkId: exampleCoreNetwork.ID(),
SubnetArns: toPulumiAnyArray(splat0),
VpcArn: pulumi.Any(aws_vpc.Example.Arn),
})
if err != nil {
return err
}
exampleCoreNetworkPolicyDocument := networkmanager.GetCoreNetworkPolicyDocumentOutput(ctx, networkmanager.GetCoreNetworkPolicyDocumentOutputArgs{
CoreNetworkConfigurations: networkmanager.GetCoreNetworkPolicyDocumentCoreNetworkConfigurationArray{
&networkmanager.GetCoreNetworkPolicyDocumentCoreNetworkConfigurationArgs{
AsnRanges: pulumi.StringArray{
pulumi.String("65022-65534"),
},
EdgeLocations: networkmanager.GetCoreNetworkPolicyDocumentCoreNetworkConfigurationEdgeLocationArray{
&networkmanager.GetCoreNetworkPolicyDocumentCoreNetworkConfigurationEdgeLocationArgs{
Location: pulumi.String("us-west-2"),
},
},
},
},
Segments: networkmanager.GetCoreNetworkPolicyDocumentSegmentArray{
&networkmanager.GetCoreNetworkPolicyDocumentSegmentArgs{
Name: pulumi.String("segment"),
},
},
SegmentActions: networkmanager.GetCoreNetworkPolicyDocumentSegmentActionArray{
&networkmanager.GetCoreNetworkPolicyDocumentSegmentActionArgs{
Action: pulumi.String("create-route"),
Segment: pulumi.String("segment"),
DestinationCidrBlocks: pulumi.StringArray{
pulumi.String("0.0.0.0/0"),
},
Destinations: pulumi.StringArray{
exampleVpcAttachment.ID(),
},
},
},
}, nil)
_, err = networkmanager.NewCoreNetworkPolicyAttachment(ctx, "exampleCoreNetworkPolicyAttachment", &networkmanager.CoreNetworkPolicyAttachmentArgs{
CoreNetworkId: exampleCoreNetwork.ID(),
PolicyDocument: exampleCoreNetworkPolicyDocument.ApplyT(func(exampleCoreNetworkPolicyDocument networkmanager.GetCoreNetworkPolicyDocumentResult) (*string, error) {
return &exampleCoreNetworkPolicyDocument.Json, nil
}).(pulumi.StringPtrOutput),
})
if err != nil {
return err
}
return nil
})
}
func toPulumiAnyArray(arr []Any) pulumi.AnyArray {
var pulumiArr pulumi.AnyArray
for _, v := range arr {
pulumiArr = append(pulumiArr, pulumi.Any(v))
}
return pulumiArr
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.networkmanager.GlobalNetwork;
import com.pulumi.aws.networkmanager.CoreNetwork;
import com.pulumi.aws.networkmanager.CoreNetworkArgs;
import com.pulumi.aws.networkmanager.VpcAttachment;
import com.pulumi.aws.networkmanager.VpcAttachmentArgs;
import com.pulumi.aws.networkmanager.NetworkmanagerFunctions;
import com.pulumi.aws.networkmanager.inputs.GetCoreNetworkPolicyDocumentArgs;
import com.pulumi.aws.networkmanager.CoreNetworkPolicyAttachment;
import com.pulumi.aws.networkmanager.CoreNetworkPolicyAttachmentArgs;
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 exampleGlobalNetwork = new GlobalNetwork("exampleGlobalNetwork");
var exampleCoreNetwork = new CoreNetwork("exampleCoreNetwork", CoreNetworkArgs.builder()
.globalNetworkId(exampleGlobalNetwork.id())
.createBasePolicy(true)
.build());
var exampleVpcAttachment = new VpcAttachment("exampleVpcAttachment", VpcAttachmentArgs.builder()
.coreNetworkId(exampleCoreNetwork.id())
.subnetArns(aws_subnet.example().stream().map(element -> element.arn()).collect(toList()))
.vpcArn(aws_vpc.example().arn())
.build());
final var exampleCoreNetworkPolicyDocument = NetworkmanagerFunctions.getCoreNetworkPolicyDocument(GetCoreNetworkPolicyDocumentArgs.builder()
.coreNetworkConfigurations(GetCoreNetworkPolicyDocumentCoreNetworkConfigurationArgs.builder()
.asnRanges("65022-65534")
.edgeLocations(GetCoreNetworkPolicyDocumentCoreNetworkConfigurationEdgeLocationArgs.builder()
.location("us-west-2")
.build())
.build())
.segments(GetCoreNetworkPolicyDocumentSegmentArgs.builder()
.name("segment")
.build())
.segmentActions(GetCoreNetworkPolicyDocumentSegmentActionArgs.builder()
.action("create-route")
.segment("segment")
.destinationCidrBlocks("0.0.0.0/0")
.destinations(exampleVpcAttachment.id())
.build())
.build());
var exampleCoreNetworkPolicyAttachment = new CoreNetworkPolicyAttachment("exampleCoreNetworkPolicyAttachment", CoreNetworkPolicyAttachmentArgs.builder()
.coreNetworkId(exampleCoreNetwork.id())
.policyDocument(exampleCoreNetworkPolicyDocument.applyValue(getCoreNetworkPolicyDocumentResult -> getCoreNetworkPolicyDocumentResult).applyValue(exampleCoreNetworkPolicyDocument -> exampleCoreNetworkPolicyDocument.applyValue(getCoreNetworkPolicyDocumentResult -> getCoreNetworkPolicyDocumentResult.json())))
.build());
}
}
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const exampleGlobalNetwork = new aws.networkmanager.GlobalNetwork("exampleGlobalNetwork", {});
const exampleCoreNetwork = new aws.networkmanager.CoreNetwork("exampleCoreNetwork", {
globalNetworkId: exampleGlobalNetwork.id,
createBasePolicy: true,
});
const exampleVpcAttachment = new aws.networkmanager.VpcAttachment("exampleVpcAttachment", {
coreNetworkId: exampleCoreNetwork.id,
subnetArns: aws_subnet.example.map(__item => __item.arn),
vpcArn: aws_vpc.example.arn,
});
const exampleCoreNetworkPolicyDocument = aws.networkmanager.getCoreNetworkPolicyDocumentOutput({
coreNetworkConfigurations: [{
asnRanges: ["65022-65534"],
edgeLocations: [{
location: "us-west-2",
}],
}],
segments: [{
name: "segment",
}],
segmentActions: [{
action: "create-route",
segment: "segment",
destinationCidrBlocks: ["0.0.0.0/0"],
destinations: [exampleVpcAttachment.id],
}],
});
const exampleCoreNetworkPolicyAttachment = new aws.networkmanager.CoreNetworkPolicyAttachment("exampleCoreNetworkPolicyAttachment", {
coreNetworkId: exampleCoreNetwork.id,
policyDocument: exampleCoreNetworkPolicyDocument.apply(exampleCoreNetworkPolicyDocument => exampleCoreNetworkPolicyDocument.json),
});
import pulumi
import pulumi_aws as aws
example_global_network = aws.networkmanager.GlobalNetwork("exampleGlobalNetwork")
example_core_network = aws.networkmanager.CoreNetwork("exampleCoreNetwork",
global_network_id=example_global_network.id,
create_base_policy=True)
example_vpc_attachment = aws.networkmanager.VpcAttachment("exampleVpcAttachment",
core_network_id=example_core_network.id,
subnet_arns=[__item["arn"] for __item in aws_subnet["example"]],
vpc_arn=aws_vpc["example"]["arn"])
example_core_network_policy_document = aws.networkmanager.get_core_network_policy_document_output(core_network_configurations=[aws.networkmanager.GetCoreNetworkPolicyDocumentCoreNetworkConfigurationArgs(
asn_ranges=["65022-65534"],
edge_locations=[aws.networkmanager.GetCoreNetworkPolicyDocumentCoreNetworkConfigurationEdgeLocationArgs(
location="us-west-2",
)],
)],
segments=[aws.networkmanager.GetCoreNetworkPolicyDocumentSegmentArgs(
name="segment",
)],
segment_actions=[aws.networkmanager.GetCoreNetworkPolicyDocumentSegmentActionArgs(
action="create-route",
segment="segment",
destination_cidr_blocks=["0.0.0.0/0"],
destinations=[example_vpc_attachment.id],
)])
example_core_network_policy_attachment = aws.networkmanager.CoreNetworkPolicyAttachment("exampleCoreNetworkPolicyAttachment",
core_network_id=example_core_network.id,
policy_document=example_core_network_policy_document.json)
Example coming soon!
With VPC Attachment (Multi-Region)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var exampleGlobalNetwork = new Aws.NetworkManager.GlobalNetwork("exampleGlobalNetwork");
var exampleCoreNetwork = new Aws.NetworkManager.CoreNetwork("exampleCoreNetwork", new()
{
GlobalNetworkId = exampleGlobalNetwork.Id,
BasePolicyRegions = new[]
{
"us-west-2",
"us-east-1",
},
CreateBasePolicy = true,
});
var exampleUsWest2 = new Aws.NetworkManager.VpcAttachment("exampleUsWest2", new()
{
CoreNetworkId = exampleCoreNetwork.Id,
SubnetArns = aws_subnet.Example_us_west_2.Select(__item => __item.Arn).ToList(),
VpcArn = aws_vpc.Example_us_west_2.Arn,
});
var exampleUsEast1 = new Aws.NetworkManager.VpcAttachment("exampleUsEast1", new()
{
CoreNetworkId = exampleCoreNetwork.Id,
SubnetArns = aws_subnet.Example_us_east_1.Select(__item => __item.Arn).ToList(),
VpcArn = aws_vpc.Example_us_east_1.Arn,
}, new CustomResourceOptions
{
Provider = "alternate",
});
var exampleCoreNetworkPolicyDocument = Aws.NetworkManager.GetCoreNetworkPolicyDocument.Invoke(new()
{
CoreNetworkConfigurations = new[]
{
new Aws.NetworkManager.Inputs.GetCoreNetworkPolicyDocumentCoreNetworkConfigurationInputArgs
{
AsnRanges = new[]
{
"65022-65534",
},
EdgeLocations = new[]
{
new Aws.NetworkManager.Inputs.GetCoreNetworkPolicyDocumentCoreNetworkConfigurationEdgeLocationInputArgs
{
Location = "us-west-2",
},
new Aws.NetworkManager.Inputs.GetCoreNetworkPolicyDocumentCoreNetworkConfigurationEdgeLocationInputArgs
{
Location = "us-east-1",
},
},
},
},
Segments = new[]
{
new Aws.NetworkManager.Inputs.GetCoreNetworkPolicyDocumentSegmentInputArgs
{
Name = "segment",
},
new Aws.NetworkManager.Inputs.GetCoreNetworkPolicyDocumentSegmentInputArgs
{
Name = "segment2",
},
},
SegmentActions = new[]
{
new Aws.NetworkManager.Inputs.GetCoreNetworkPolicyDocumentSegmentActionInputArgs
{
Action = "create-route",
Segment = "segment",
DestinationCidrBlocks = new[]
{
"10.0.0.0/16",
},
Destinations = new[]
{
exampleUsWest2.Id,
},
},
new Aws.NetworkManager.Inputs.GetCoreNetworkPolicyDocumentSegmentActionInputArgs
{
Action = "create-route",
Segment = "segment",
DestinationCidrBlocks = new[]
{
"10.1.0.0/16",
},
Destinations = new[]
{
exampleUsEast1.Id,
},
},
},
});
var exampleCoreNetworkPolicyAttachment = new Aws.NetworkManager.CoreNetworkPolicyAttachment("exampleCoreNetworkPolicyAttachment", new()
{
CoreNetworkId = exampleCoreNetwork.Id,
PolicyDocument = exampleCoreNetworkPolicyDocument.Apply(getCoreNetworkPolicyDocumentResult => getCoreNetworkPolicyDocumentResult.Json),
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/networkmanager"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleGlobalNetwork, err := networkmanager.NewGlobalNetwork(ctx, "exampleGlobalNetwork", nil)
if err != nil {
return err
}
exampleCoreNetwork, err := networkmanager.NewCoreNetwork(ctx, "exampleCoreNetwork", &networkmanager.CoreNetworkArgs{
GlobalNetworkId: exampleGlobalNetwork.ID(),
BasePolicyRegions: pulumi.StringArray{
pulumi.String("us-west-2"),
pulumi.String("us-east-1"),
},
CreateBasePolicy: pulumi.Bool(true),
})
if err != nil {
return err
}
var splat0 []interface{}
for _, val0 := range aws_subnet.Example_us_west_2 {
splat0 = append(splat0, val0.Arn)
}
exampleUsWest2, err := networkmanager.NewVpcAttachment(ctx, "exampleUsWest2", &networkmanager.VpcAttachmentArgs{
CoreNetworkId: exampleCoreNetwork.ID(),
SubnetArns: toPulumiAnyArray(splat0),
VpcArn: pulumi.Any(aws_vpc.Example_us_west_2.Arn),
})
if err != nil {
return err
}
var splat1 []interface{}
for _, val0 := range aws_subnet.Example_us_east_1 {
splat1 = append(splat1, val0.Arn)
}
exampleUsEast1, err := networkmanager.NewVpcAttachment(ctx, "exampleUsEast1", &networkmanager.VpcAttachmentArgs{
CoreNetworkId: exampleCoreNetwork.ID(),
SubnetArns: toPulumiAnyArray(splat1),
VpcArn: pulumi.Any(aws_vpc.Example_us_east_1.Arn),
}, pulumi.Provider("alternate"))
if err != nil {
return err
}
exampleCoreNetworkPolicyDocument := networkmanager.GetCoreNetworkPolicyDocumentOutput(ctx, networkmanager.GetCoreNetworkPolicyDocumentOutputArgs{
CoreNetworkConfigurations: networkmanager.GetCoreNetworkPolicyDocumentCoreNetworkConfigurationArray{
&networkmanager.GetCoreNetworkPolicyDocumentCoreNetworkConfigurationArgs{
AsnRanges: pulumi.StringArray{
pulumi.String("65022-65534"),
},
EdgeLocations: networkmanager.GetCoreNetworkPolicyDocumentCoreNetworkConfigurationEdgeLocationArray{
&networkmanager.GetCoreNetworkPolicyDocumentCoreNetworkConfigurationEdgeLocationArgs{
Location: pulumi.String("us-west-2"),
},
&networkmanager.GetCoreNetworkPolicyDocumentCoreNetworkConfigurationEdgeLocationArgs{
Location: pulumi.String("us-east-1"),
},
},
},
},
Segments: networkmanager.GetCoreNetworkPolicyDocumentSegmentArray{
&networkmanager.GetCoreNetworkPolicyDocumentSegmentArgs{
Name: pulumi.String("segment"),
},
&networkmanager.GetCoreNetworkPolicyDocumentSegmentArgs{
Name: pulumi.String("segment2"),
},
},
SegmentActions: networkmanager.GetCoreNetworkPolicyDocumentSegmentActionArray{
&networkmanager.GetCoreNetworkPolicyDocumentSegmentActionArgs{
Action: pulumi.String("create-route"),
Segment: pulumi.String("segment"),
DestinationCidrBlocks: pulumi.StringArray{
pulumi.String("10.0.0.0/16"),
},
Destinations: pulumi.StringArray{
exampleUsWest2.ID(),
},
},
&networkmanager.GetCoreNetworkPolicyDocumentSegmentActionArgs{
Action: pulumi.String("create-route"),
Segment: pulumi.String("segment"),
DestinationCidrBlocks: pulumi.StringArray{
pulumi.String("10.1.0.0/16"),
},
Destinations: pulumi.StringArray{
exampleUsEast1.ID(),
},
},
},
}, nil)
_, err = networkmanager.NewCoreNetworkPolicyAttachment(ctx, "exampleCoreNetworkPolicyAttachment", &networkmanager.CoreNetworkPolicyAttachmentArgs{
CoreNetworkId: exampleCoreNetwork.ID(),
PolicyDocument: exampleCoreNetworkPolicyDocument.ApplyT(func(exampleCoreNetworkPolicyDocument networkmanager.GetCoreNetworkPolicyDocumentResult) (*string, error) {
return &exampleCoreNetworkPolicyDocument.Json, nil
}).(pulumi.StringPtrOutput),
})
if err != nil {
return err
}
return nil
})
}
func toPulumiAnyArray(arr []Any) pulumi.AnyArray {
var pulumiArr pulumi.AnyArray
for _, v := range arr {
pulumiArr = append(pulumiArr, pulumi.Any(v))
}
return pulumiArr
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.networkmanager.GlobalNetwork;
import com.pulumi.aws.networkmanager.CoreNetwork;
import com.pulumi.aws.networkmanager.CoreNetworkArgs;
import com.pulumi.aws.networkmanager.VpcAttachment;
import com.pulumi.aws.networkmanager.VpcAttachmentArgs;
import com.pulumi.aws.networkmanager.NetworkmanagerFunctions;
import com.pulumi.aws.networkmanager.inputs.GetCoreNetworkPolicyDocumentArgs;
import com.pulumi.aws.networkmanager.CoreNetworkPolicyAttachment;
import com.pulumi.aws.networkmanager.CoreNetworkPolicyAttachmentArgs;
import com.pulumi.resources.CustomResourceOptions;
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 exampleGlobalNetwork = new GlobalNetwork("exampleGlobalNetwork");
var exampleCoreNetwork = new CoreNetwork("exampleCoreNetwork", CoreNetworkArgs.builder()
.globalNetworkId(exampleGlobalNetwork.id())
.basePolicyRegions(
"us-west-2",
"us-east-1")
.createBasePolicy(true)
.build());
var exampleUsWest2 = new VpcAttachment("exampleUsWest2", VpcAttachmentArgs.builder()
.coreNetworkId(exampleCoreNetwork.id())
.subnetArns(aws_subnet.example_us_west_2().stream().map(element -> element.arn()).collect(toList()))
.vpcArn(aws_vpc.example_us_west_2().arn())
.build());
var exampleUsEast1 = new VpcAttachment("exampleUsEast1", VpcAttachmentArgs.builder()
.coreNetworkId(exampleCoreNetwork.id())
.subnetArns(aws_subnet.example_us_east_1().stream().map(element -> element.arn()).collect(toList()))
.vpcArn(aws_vpc.example_us_east_1().arn())
.build(), CustomResourceOptions.builder()
.provider("alternate")
.build());
final var exampleCoreNetworkPolicyDocument = NetworkmanagerFunctions.getCoreNetworkPolicyDocument(GetCoreNetworkPolicyDocumentArgs.builder()
.coreNetworkConfigurations(GetCoreNetworkPolicyDocumentCoreNetworkConfigurationArgs.builder()
.asnRanges("65022-65534")
.edgeLocations(
GetCoreNetworkPolicyDocumentCoreNetworkConfigurationEdgeLocationArgs.builder()
.location("us-west-2")
.build(),
GetCoreNetworkPolicyDocumentCoreNetworkConfigurationEdgeLocationArgs.builder()
.location("us-east-1")
.build())
.build())
.segments(
GetCoreNetworkPolicyDocumentSegmentArgs.builder()
.name("segment")
.build(),
GetCoreNetworkPolicyDocumentSegmentArgs.builder()
.name("segment2")
.build())
.segmentActions(
GetCoreNetworkPolicyDocumentSegmentActionArgs.builder()
.action("create-route")
.segment("segment")
.destinationCidrBlocks("10.0.0.0/16")
.destinations(exampleUsWest2.id())
.build(),
GetCoreNetworkPolicyDocumentSegmentActionArgs.builder()
.action("create-route")
.segment("segment")
.destinationCidrBlocks("10.1.0.0/16")
.destinations(exampleUsEast1.id())
.build())
.build());
var exampleCoreNetworkPolicyAttachment = new CoreNetworkPolicyAttachment("exampleCoreNetworkPolicyAttachment", CoreNetworkPolicyAttachmentArgs.builder()
.coreNetworkId(exampleCoreNetwork.id())
.policyDocument(exampleCoreNetworkPolicyDocument.applyValue(getCoreNetworkPolicyDocumentResult -> getCoreNetworkPolicyDocumentResult).applyValue(exampleCoreNetworkPolicyDocument -> exampleCoreNetworkPolicyDocument.applyValue(getCoreNetworkPolicyDocumentResult -> getCoreNetworkPolicyDocumentResult.json())))
.build());
}
}
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const exampleGlobalNetwork = new aws.networkmanager.GlobalNetwork("exampleGlobalNetwork", {});
const exampleCoreNetwork = new aws.networkmanager.CoreNetwork("exampleCoreNetwork", {
globalNetworkId: exampleGlobalNetwork.id,
basePolicyRegions: [
"us-west-2",
"us-east-1",
],
createBasePolicy: true,
});
const exampleUsWest2 = new aws.networkmanager.VpcAttachment("exampleUsWest2", {
coreNetworkId: exampleCoreNetwork.id,
subnetArns: aws_subnet.example_us_west_2.map(__item => __item.arn),
vpcArn: aws_vpc.example_us_west_2.arn,
});
const exampleUsEast1 = new aws.networkmanager.VpcAttachment("exampleUsEast1", {
coreNetworkId: exampleCoreNetwork.id,
subnetArns: aws_subnet.example_us_east_1.map(__item => __item.arn),
vpcArn: aws_vpc.example_us_east_1.arn,
}, {
provider: "alternate",
});
const exampleCoreNetworkPolicyDocument = aws.networkmanager.getCoreNetworkPolicyDocumentOutput({
coreNetworkConfigurations: [{
asnRanges: ["65022-65534"],
edgeLocations: [
{
location: "us-west-2",
},
{
location: "us-east-1",
},
],
}],
segments: [
{
name: "segment",
},
{
name: "segment2",
},
],
segmentActions: [
{
action: "create-route",
segment: "segment",
destinationCidrBlocks: ["10.0.0.0/16"],
destinations: [exampleUsWest2.id],
},
{
action: "create-route",
segment: "segment",
destinationCidrBlocks: ["10.1.0.0/16"],
destinations: [exampleUsEast1.id],
},
],
});
const exampleCoreNetworkPolicyAttachment = new aws.networkmanager.CoreNetworkPolicyAttachment("exampleCoreNetworkPolicyAttachment", {
coreNetworkId: exampleCoreNetwork.id,
policyDocument: exampleCoreNetworkPolicyDocument.apply(exampleCoreNetworkPolicyDocument => exampleCoreNetworkPolicyDocument.json),
});
import pulumi
import pulumi_aws as aws
example_global_network = aws.networkmanager.GlobalNetwork("exampleGlobalNetwork")
example_core_network = aws.networkmanager.CoreNetwork("exampleCoreNetwork",
global_network_id=example_global_network.id,
base_policy_regions=[
"us-west-2",
"us-east-1",
],
create_base_policy=True)
example_us_west2 = aws.networkmanager.VpcAttachment("exampleUsWest2",
core_network_id=example_core_network.id,
subnet_arns=[__item["arn"] for __item in aws_subnet["example_us_west_2"]],
vpc_arn=aws_vpc["example_us_west_2"]["arn"])
example_us_east1 = aws.networkmanager.VpcAttachment("exampleUsEast1",
core_network_id=example_core_network.id,
subnet_arns=[__item["arn"] for __item in aws_subnet["example_us_east_1"]],
vpc_arn=aws_vpc["example_us_east_1"]["arn"],
opts=pulumi.ResourceOptions(provider="alternate"))
example_core_network_policy_document = aws.networkmanager.get_core_network_policy_document_output(core_network_configurations=[aws.networkmanager.GetCoreNetworkPolicyDocumentCoreNetworkConfigurationArgs(
asn_ranges=["65022-65534"],
edge_locations=[
aws.networkmanager.GetCoreNetworkPolicyDocumentCoreNetworkConfigurationEdgeLocationArgs(
location="us-west-2",
),
aws.networkmanager.GetCoreNetworkPolicyDocumentCoreNetworkConfigurationEdgeLocationArgs(
location="us-east-1",
),
],
)],
segments=[
aws.networkmanager.GetCoreNetworkPolicyDocumentSegmentArgs(
name="segment",
),
aws.networkmanager.GetCoreNetworkPolicyDocumentSegmentArgs(
name="segment2",
),
],
segment_actions=[
aws.networkmanager.GetCoreNetworkPolicyDocumentSegmentActionArgs(
action="create-route",
segment="segment",
destination_cidr_blocks=["10.0.0.0/16"],
destinations=[example_us_west2.id],
),
aws.networkmanager.GetCoreNetworkPolicyDocumentSegmentActionArgs(
action="create-route",
segment="segment",
destination_cidr_blocks=["10.1.0.0/16"],
destinations=[example_us_east1.id],
),
])
example_core_network_policy_attachment = aws.networkmanager.CoreNetworkPolicyAttachment("exampleCoreNetworkPolicyAttachment",
core_network_id=example_core_network.id,
policy_document=example_core_network_policy_document.json)
Example coming soon!
Create CoreNetworkPolicyAttachment Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new CoreNetworkPolicyAttachment(name: string, args: CoreNetworkPolicyAttachmentArgs, opts?: CustomResourceOptions);@overload
def CoreNetworkPolicyAttachment(resource_name: str,
args: CoreNetworkPolicyAttachmentArgs,
opts: Optional[ResourceOptions] = None)
@overload
def CoreNetworkPolicyAttachment(resource_name: str,
opts: Optional[ResourceOptions] = None,
core_network_id: Optional[str] = None,
policy_document: Optional[str] = None)func NewCoreNetworkPolicyAttachment(ctx *Context, name string, args CoreNetworkPolicyAttachmentArgs, opts ...ResourceOption) (*CoreNetworkPolicyAttachment, error)public CoreNetworkPolicyAttachment(string name, CoreNetworkPolicyAttachmentArgs args, CustomResourceOptions? opts = null)
public CoreNetworkPolicyAttachment(String name, CoreNetworkPolicyAttachmentArgs args)
public CoreNetworkPolicyAttachment(String name, CoreNetworkPolicyAttachmentArgs args, CustomResourceOptions options)
type: aws:networkmanager:CoreNetworkPolicyAttachment
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 CoreNetworkPolicyAttachmentArgs
- 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 CoreNetworkPolicyAttachmentArgs
- 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 CoreNetworkPolicyAttachmentArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args CoreNetworkPolicyAttachmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args CoreNetworkPolicyAttachmentArgs
- 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 coreNetworkPolicyAttachmentResource = new Aws.NetworkManager.CoreNetworkPolicyAttachment("coreNetworkPolicyAttachmentResource", new()
{
CoreNetworkId = "string",
PolicyDocument = "string",
});
example, err := networkmanager.NewCoreNetworkPolicyAttachment(ctx, "coreNetworkPolicyAttachmentResource", &networkmanager.CoreNetworkPolicyAttachmentArgs{
CoreNetworkId: pulumi.String("string"),
PolicyDocument: pulumi.String("string"),
})
var coreNetworkPolicyAttachmentResource = new CoreNetworkPolicyAttachment("coreNetworkPolicyAttachmentResource", CoreNetworkPolicyAttachmentArgs.builder()
.coreNetworkId("string")
.policyDocument("string")
.build());
core_network_policy_attachment_resource = aws.networkmanager.CoreNetworkPolicyAttachment("coreNetworkPolicyAttachmentResource",
core_network_id="string",
policy_document="string")
const coreNetworkPolicyAttachmentResource = new aws.networkmanager.CoreNetworkPolicyAttachment("coreNetworkPolicyAttachmentResource", {
coreNetworkId: "string",
policyDocument: "string",
});
type: aws:networkmanager:CoreNetworkPolicyAttachment
properties:
coreNetworkId: string
policyDocument: string
CoreNetworkPolicyAttachment 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 CoreNetworkPolicyAttachment resource accepts the following input properties:
- Core
Network stringId - The ID of the core network that a policy will be attached to and made
LIVE. - Policy
Document string - Policy document for creating a core network. Note that updating this argument will result in the new policy document version being set as the
LATESTandLIVEpolicy document. Refer to the Core network policies documentation for more information.
- Core
Network stringId - The ID of the core network that a policy will be attached to and made
LIVE. - Policy
Document string - Policy document for creating a core network. Note that updating this argument will result in the new policy document version being set as the
LATESTandLIVEpolicy document. Refer to the Core network policies documentation for more information.
- core
Network StringId - The ID of the core network that a policy will be attached to and made
LIVE. - policy
Document String - Policy document for creating a core network. Note that updating this argument will result in the new policy document version being set as the
LATESTandLIVEpolicy document. Refer to the Core network policies documentation for more information.
- core
Network stringId - The ID of the core network that a policy will be attached to and made
LIVE. - policy
Document string - Policy document for creating a core network. Note that updating this argument will result in the new policy document version being set as the
LATESTandLIVEpolicy document. Refer to the Core network policies documentation for more information.
- core_
network_ strid - The ID of the core network that a policy will be attached to and made
LIVE. - policy_
document str - Policy document for creating a core network. Note that updating this argument will result in the new policy document version being set as the
LATESTandLIVEpolicy document. Refer to the Core network policies documentation for more information.
- core
Network StringId - The ID of the core network that a policy will be attached to and made
LIVE. - policy
Document String - Policy document for creating a core network. Note that updating this argument will result in the new policy document version being set as the
LATESTandLIVEpolicy document. Refer to the Core network policies documentation for more information.
Outputs
All input properties are implicitly available as output properties. Additionally, the CoreNetworkPolicyAttachment resource produces the following output properties:
Look up Existing CoreNetworkPolicyAttachment Resource
Get an existing CoreNetworkPolicyAttachment 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?: CoreNetworkPolicyAttachmentState, opts?: CustomResourceOptions): CoreNetworkPolicyAttachment@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
core_network_id: Optional[str] = None,
policy_document: Optional[str] = None,
state: Optional[str] = None) -> CoreNetworkPolicyAttachmentfunc GetCoreNetworkPolicyAttachment(ctx *Context, name string, id IDInput, state *CoreNetworkPolicyAttachmentState, opts ...ResourceOption) (*CoreNetworkPolicyAttachment, error)public static CoreNetworkPolicyAttachment Get(string name, Input<string> id, CoreNetworkPolicyAttachmentState? state, CustomResourceOptions? opts = null)public static CoreNetworkPolicyAttachment get(String name, Output<String> id, CoreNetworkPolicyAttachmentState state, CustomResourceOptions options)resources: _: type: aws:networkmanager:CoreNetworkPolicyAttachment 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.
- Core
Network stringId - The ID of the core network that a policy will be attached to and made
LIVE. - Policy
Document string - Policy document for creating a core network. Note that updating this argument will result in the new policy document version being set as the
LATESTandLIVEpolicy document. Refer to the Core network policies documentation for more information. - State string
- Current state of a core network.
- Core
Network stringId - The ID of the core network that a policy will be attached to and made
LIVE. - Policy
Document string - Policy document for creating a core network. Note that updating this argument will result in the new policy document version being set as the
LATESTandLIVEpolicy document. Refer to the Core network policies documentation for more information. - State string
- Current state of a core network.
- core
Network StringId - The ID of the core network that a policy will be attached to and made
LIVE. - policy
Document String - Policy document for creating a core network. Note that updating this argument will result in the new policy document version being set as the
LATESTandLIVEpolicy document. Refer to the Core network policies documentation for more information. - state String
- Current state of a core network.
- core
Network stringId - The ID of the core network that a policy will be attached to and made
LIVE. - policy
Document string - Policy document for creating a core network. Note that updating this argument will result in the new policy document version being set as the
LATESTandLIVEpolicy document. Refer to the Core network policies documentation for more information. - state string
- Current state of a core network.
- core_
network_ strid - The ID of the core network that a policy will be attached to and made
LIVE. - policy_
document str - Policy document for creating a core network. Note that updating this argument will result in the new policy document version being set as the
LATESTandLIVEpolicy document. Refer to the Core network policies documentation for more information. - state str
- Current state of a core network.
- core
Network StringId - The ID of the core network that a policy will be attached to and made
LIVE. - policy
Document String - Policy document for creating a core network. Note that updating this argument will result in the new policy document version being set as the
LATESTandLIVEpolicy document. Refer to the Core network policies documentation for more information. - state String
- Current state of a core network.
Import
aws_networkmanager_core_network_policy_attachment can be imported using the core network ID, e.g.
$ pulumi import aws:networkmanager/coreNetworkPolicyAttachment:CoreNetworkPolicyAttachment example core-network-0d47f6t230mz46dy4
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.
published on Tuesday, Mar 10, 2026 by Pulumi
