github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/networkmanager/getCoreNetworkPolicyDocument.go (about) 1 // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT. 2 // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** 3 4 package networkmanager 5 6 import ( 7 "context" 8 "reflect" 9 10 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 11 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 12 ) 13 14 // Generates a Core Network policy document in JSON format for use with resources that expect core network policy documents such as `awsccNetworkmanagerCoreNetwork`. It follows the API definition from the [core-network-policy documentation](https://docs.aws.amazon.com/vpc/latest/cloudwan/cloudwan-policies-json.html). 15 // 16 // Using this data source to generate policy documents is *optional*. It is also valid to use literal JSON strings in your configuration or to use the `file` interpolation function to read a raw JSON policy document from a file. 17 // 18 // ## Example Usage 19 // 20 // ### Basic Example 21 // 22 // <!--Start PulumiCodeChooser --> 23 // ```go 24 // package main 25 // 26 // import ( 27 // 28 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/networkmanager" 29 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 30 // 31 // ) 32 // 33 // func main() { 34 // pulumi.Run(func(ctx *pulumi.Context) error { 35 // _, err := networkmanager.GetCoreNetworkPolicyDocument(ctx, &networkmanager.GetCoreNetworkPolicyDocumentArgs{ 36 // CoreNetworkConfigurations: []networkmanager.GetCoreNetworkPolicyDocumentCoreNetworkConfiguration{ 37 // { 38 // VpnEcmpSupport: pulumi.BoolRef(false), 39 // AsnRanges: []string{ 40 // "64512-64555", 41 // }, 42 // EdgeLocations: []networkmanager.GetCoreNetworkPolicyDocumentCoreNetworkConfigurationEdgeLocation{ 43 // { 44 // Location: "us-east-1", 45 // Asn: pulumi.StringRef("64512"), 46 // }, 47 // { 48 // Location: "eu-central-1", 49 // Asn: pulumi.StringRef("64513"), 50 // }, 51 // }, 52 // }, 53 // }, 54 // Segments: []networkmanager.GetCoreNetworkPolicyDocumentSegment{ 55 // { 56 // Name: "shared", 57 // Description: pulumi.StringRef("Segment for shared services"), 58 // RequireAttachmentAcceptance: pulumi.BoolRef(true), 59 // }, 60 // { 61 // Name: "prod", 62 // Description: pulumi.StringRef("Segment for prod services"), 63 // RequireAttachmentAcceptance: pulumi.BoolRef(true), 64 // }, 65 // }, 66 // SegmentActions: []networkmanager.GetCoreNetworkPolicyDocumentSegmentAction{ 67 // { 68 // Action: "share", 69 // Mode: pulumi.StringRef("attachment-route"), 70 // Segment: "shared", 71 // ShareWiths: []string{ 72 // "*", 73 // }, 74 // }, 75 // }, 76 // AttachmentPolicies: []networkmanager.GetCoreNetworkPolicyDocumentAttachmentPolicy{ 77 // { 78 // RuleNumber: 100, 79 // ConditionLogic: pulumi.StringRef("or"), 80 // Conditions: []networkmanager.GetCoreNetworkPolicyDocumentAttachmentPolicyCondition{ 81 // { 82 // Type: "tag-value", 83 // Operator: pulumi.StringRef("equals"), 84 // Key: pulumi.StringRef("segment"), 85 // Value: pulumi.StringRef("shared"), 86 // }, 87 // }, 88 // Action: { 89 // AssociationMethod: "constant", 90 // Segment: pulumi.StringRef("shared"), 91 // }, 92 // }, 93 // { 94 // RuleNumber: 200, 95 // ConditionLogic: pulumi.StringRef("or"), 96 // Conditions: []networkmanager.GetCoreNetworkPolicyDocumentAttachmentPolicyCondition{ 97 // { 98 // Type: "tag-value", 99 // Operator: pulumi.StringRef("equals"), 100 // Key: pulumi.StringRef("segment"), 101 // Value: pulumi.StringRef("prod"), 102 // }, 103 // }, 104 // Action: { 105 // AssociationMethod: "constant", 106 // Segment: pulumi.StringRef("prod"), 107 // }, 108 // }, 109 // }, 110 // }, nil) 111 // if err != nil { 112 // return err 113 // } 114 // return nil 115 // }) 116 // } 117 // 118 // ``` 119 // <!--End PulumiCodeChooser --> 120 // 121 // `data.aws_networkmanager_core_network_policy_document.test.json` will evaluate to: 122 func GetCoreNetworkPolicyDocument(ctx *pulumi.Context, args *GetCoreNetworkPolicyDocumentArgs, opts ...pulumi.InvokeOption) (*GetCoreNetworkPolicyDocumentResult, error) { 123 opts = internal.PkgInvokeDefaultOpts(opts) 124 var rv GetCoreNetworkPolicyDocumentResult 125 err := ctx.Invoke("aws:networkmanager/getCoreNetworkPolicyDocument:getCoreNetworkPolicyDocument", args, &rv, opts...) 126 if err != nil { 127 return nil, err 128 } 129 return &rv, nil 130 } 131 132 // A collection of arguments for invoking getCoreNetworkPolicyDocument. 133 type GetCoreNetworkPolicyDocumentArgs struct { 134 // In a core network, all attachments use the block argument `attachmentPolicies` section to map an attachment to a segment. Instead of manually associating a segment to each attachment, attachments use tags, and then the tags are used to associate the attachment to the specified segment. Detailed below. 135 AttachmentPolicies []GetCoreNetworkPolicyDocumentAttachmentPolicy `pulumi:"attachmentPolicies"` 136 // The core network configuration section defines the Regions where a core network should operate. For AWS Regions that are defined in the policy, the core network creates a Core Network Edge where you can connect attachments. After it's created, each Core Network Edge is peered with every other defined Region and is configured with consistent segment and routing across all Regions. Regions cannot be removed until the associated attachments are deleted. Detailed below. 137 CoreNetworkConfigurations []GetCoreNetworkPolicyDocumentCoreNetworkConfiguration `pulumi:"coreNetworkConfigurations"` 138 // A block argument, `segmentActions` define how routing works between segments. By default, attachments can only communicate with other attachments in the same segment. Detailed below. 139 SegmentActions []GetCoreNetworkPolicyDocumentSegmentAction `pulumi:"segmentActions"` 140 // Block argument that defines the different segments in the network. Here you can provide descriptions, change defaults, and provide explicit Regional operational and route filters. The names defined for each segment are used in the `segmentActions` and `attachmentPolicies` section. Each segment is created, and operates, as a completely separated routing domain. By default, attachments can only communicate with other attachments in the same segment. Detailed below. 141 Segments []GetCoreNetworkPolicyDocumentSegment `pulumi:"segments"` 142 Version *string `pulumi:"version"` 143 } 144 145 // A collection of values returned by getCoreNetworkPolicyDocument. 146 type GetCoreNetworkPolicyDocumentResult struct { 147 AttachmentPolicies []GetCoreNetworkPolicyDocumentAttachmentPolicy `pulumi:"attachmentPolicies"` 148 CoreNetworkConfigurations []GetCoreNetworkPolicyDocumentCoreNetworkConfiguration `pulumi:"coreNetworkConfigurations"` 149 // The provider-assigned unique ID for this managed resource. 150 Id string `pulumi:"id"` 151 // Standard JSON policy document rendered based on the arguments above. 152 Json string `pulumi:"json"` 153 SegmentActions []GetCoreNetworkPolicyDocumentSegmentAction `pulumi:"segmentActions"` 154 Segments []GetCoreNetworkPolicyDocumentSegment `pulumi:"segments"` 155 Version *string `pulumi:"version"` 156 } 157 158 func GetCoreNetworkPolicyDocumentOutput(ctx *pulumi.Context, args GetCoreNetworkPolicyDocumentOutputArgs, opts ...pulumi.InvokeOption) GetCoreNetworkPolicyDocumentResultOutput { 159 return pulumi.ToOutputWithContext(context.Background(), args). 160 ApplyT(func(v interface{}) (GetCoreNetworkPolicyDocumentResult, error) { 161 args := v.(GetCoreNetworkPolicyDocumentArgs) 162 r, err := GetCoreNetworkPolicyDocument(ctx, &args, opts...) 163 var s GetCoreNetworkPolicyDocumentResult 164 if r != nil { 165 s = *r 166 } 167 return s, err 168 }).(GetCoreNetworkPolicyDocumentResultOutput) 169 } 170 171 // A collection of arguments for invoking getCoreNetworkPolicyDocument. 172 type GetCoreNetworkPolicyDocumentOutputArgs struct { 173 // In a core network, all attachments use the block argument `attachmentPolicies` section to map an attachment to a segment. Instead of manually associating a segment to each attachment, attachments use tags, and then the tags are used to associate the attachment to the specified segment. Detailed below. 174 AttachmentPolicies GetCoreNetworkPolicyDocumentAttachmentPolicyArrayInput `pulumi:"attachmentPolicies"` 175 // The core network configuration section defines the Regions where a core network should operate. For AWS Regions that are defined in the policy, the core network creates a Core Network Edge where you can connect attachments. After it's created, each Core Network Edge is peered with every other defined Region and is configured with consistent segment and routing across all Regions. Regions cannot be removed until the associated attachments are deleted. Detailed below. 176 CoreNetworkConfigurations GetCoreNetworkPolicyDocumentCoreNetworkConfigurationArrayInput `pulumi:"coreNetworkConfigurations"` 177 // A block argument, `segmentActions` define how routing works between segments. By default, attachments can only communicate with other attachments in the same segment. Detailed below. 178 SegmentActions GetCoreNetworkPolicyDocumentSegmentActionArrayInput `pulumi:"segmentActions"` 179 // Block argument that defines the different segments in the network. Here you can provide descriptions, change defaults, and provide explicit Regional operational and route filters. The names defined for each segment are used in the `segmentActions` and `attachmentPolicies` section. Each segment is created, and operates, as a completely separated routing domain. By default, attachments can only communicate with other attachments in the same segment. Detailed below. 180 Segments GetCoreNetworkPolicyDocumentSegmentArrayInput `pulumi:"segments"` 181 Version pulumi.StringPtrInput `pulumi:"version"` 182 } 183 184 func (GetCoreNetworkPolicyDocumentOutputArgs) ElementType() reflect.Type { 185 return reflect.TypeOf((*GetCoreNetworkPolicyDocumentArgs)(nil)).Elem() 186 } 187 188 // A collection of values returned by getCoreNetworkPolicyDocument. 189 type GetCoreNetworkPolicyDocumentResultOutput struct{ *pulumi.OutputState } 190 191 func (GetCoreNetworkPolicyDocumentResultOutput) ElementType() reflect.Type { 192 return reflect.TypeOf((*GetCoreNetworkPolicyDocumentResult)(nil)).Elem() 193 } 194 195 func (o GetCoreNetworkPolicyDocumentResultOutput) ToGetCoreNetworkPolicyDocumentResultOutput() GetCoreNetworkPolicyDocumentResultOutput { 196 return o 197 } 198 199 func (o GetCoreNetworkPolicyDocumentResultOutput) ToGetCoreNetworkPolicyDocumentResultOutputWithContext(ctx context.Context) GetCoreNetworkPolicyDocumentResultOutput { 200 return o 201 } 202 203 func (o GetCoreNetworkPolicyDocumentResultOutput) AttachmentPolicies() GetCoreNetworkPolicyDocumentAttachmentPolicyArrayOutput { 204 return o.ApplyT(func(v GetCoreNetworkPolicyDocumentResult) []GetCoreNetworkPolicyDocumentAttachmentPolicy { 205 return v.AttachmentPolicies 206 }).(GetCoreNetworkPolicyDocumentAttachmentPolicyArrayOutput) 207 } 208 209 func (o GetCoreNetworkPolicyDocumentResultOutput) CoreNetworkConfigurations() GetCoreNetworkPolicyDocumentCoreNetworkConfigurationArrayOutput { 210 return o.ApplyT(func(v GetCoreNetworkPolicyDocumentResult) []GetCoreNetworkPolicyDocumentCoreNetworkConfiguration { 211 return v.CoreNetworkConfigurations 212 }).(GetCoreNetworkPolicyDocumentCoreNetworkConfigurationArrayOutput) 213 } 214 215 // The provider-assigned unique ID for this managed resource. 216 func (o GetCoreNetworkPolicyDocumentResultOutput) Id() pulumi.StringOutput { 217 return o.ApplyT(func(v GetCoreNetworkPolicyDocumentResult) string { return v.Id }).(pulumi.StringOutput) 218 } 219 220 // Standard JSON policy document rendered based on the arguments above. 221 func (o GetCoreNetworkPolicyDocumentResultOutput) Json() pulumi.StringOutput { 222 return o.ApplyT(func(v GetCoreNetworkPolicyDocumentResult) string { return v.Json }).(pulumi.StringOutput) 223 } 224 225 func (o GetCoreNetworkPolicyDocumentResultOutput) SegmentActions() GetCoreNetworkPolicyDocumentSegmentActionArrayOutput { 226 return o.ApplyT(func(v GetCoreNetworkPolicyDocumentResult) []GetCoreNetworkPolicyDocumentSegmentAction { 227 return v.SegmentActions 228 }).(GetCoreNetworkPolicyDocumentSegmentActionArrayOutput) 229 } 230 231 func (o GetCoreNetworkPolicyDocumentResultOutput) Segments() GetCoreNetworkPolicyDocumentSegmentArrayOutput { 232 return o.ApplyT(func(v GetCoreNetworkPolicyDocumentResult) []GetCoreNetworkPolicyDocumentSegment { return v.Segments }).(GetCoreNetworkPolicyDocumentSegmentArrayOutput) 233 } 234 235 func (o GetCoreNetworkPolicyDocumentResultOutput) Version() pulumi.StringPtrOutput { 236 return o.ApplyT(func(v GetCoreNetworkPolicyDocumentResult) *string { return v.Version }).(pulumi.StringPtrOutput) 237 } 238 239 func init() { 240 pulumi.RegisterOutputType(GetCoreNetworkPolicyDocumentResultOutput{}) 241 }