github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/directconnect/macsecKeyAssociation.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 directconnect 5 6 import ( 7 "context" 8 "reflect" 9 10 "errors" 11 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 12 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 13 ) 14 15 // Provides a MAC Security (MACSec) secret key resource for use with Direct Connect. See [MACsec prerequisites](https://docs.aws.amazon.com/directconnect/latest/UserGuide/direct-connect-mac-sec-getting-started.html#mac-sec-prerequisites) for information about MAC Security (MACsec) prerequisites. 16 // 17 // Creating this resource will also create a resource of type `secretsmanager.Secret` which is managed by Direct Connect. While you can import this resource into your state, because this secret is managed by Direct Connect, you will not be able to make any modifications to it. See [How AWS Direct Connect uses AWS Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/integrating_how-services-use-secrets_directconnect.html) for details. 18 // 19 // > **Note:** All arguments including `ckn` and `cak` will be stored in the raw state as plain-text. 20 // **Note:** The `secretArn` argument can only be used to reference a previously created MACSec key. You cannot associate a Secrets Manager secret created outside of the `directconnect.MacsecKeyAssociation` resource. 21 // 22 // ## Example Usage 23 // 24 // ### Create MACSec key with CKN and CAK 25 // 26 // <!--Start PulumiCodeChooser --> 27 // ```go 28 // package main 29 // 30 // import ( 31 // 32 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/directconnect" 33 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 34 // 35 // ) 36 // 37 // func main() { 38 // pulumi.Run(func(ctx *pulumi.Context) error { 39 // example, err := directconnect.LookupConnection(ctx, &directconnect.LookupConnectionArgs{ 40 // Name: "tf-dx-connection", 41 // }, nil) 42 // if err != nil { 43 // return err 44 // } 45 // _, err = directconnect.NewMacsecKeyAssociation(ctx, "test", &directconnect.MacsecKeyAssociationArgs{ 46 // ConnectionId: pulumi.String(example.Id), 47 // Ckn: pulumi.String("0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"), 48 // Cak: pulumi.String("abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789"), 49 // }) 50 // if err != nil { 51 // return err 52 // } 53 // return nil 54 // }) 55 // } 56 // 57 // ``` 58 // <!--End PulumiCodeChooser --> 59 // 60 // ### Create MACSec key with existing Secrets Manager secret 61 // 62 // <!--Start PulumiCodeChooser --> 63 // ```go 64 // package main 65 // 66 // import ( 67 // 68 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/directconnect" 69 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/secretsmanager" 70 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 71 // 72 // ) 73 // 74 // func main() { 75 // pulumi.Run(func(ctx *pulumi.Context) error { 76 // example, err := directconnect.LookupConnection(ctx, &directconnect.LookupConnectionArgs{ 77 // Name: "tf-dx-connection", 78 // }, nil) 79 // if err != nil { 80 // return err 81 // } 82 // exampleGetSecret, err := secretsmanager.LookupSecret(ctx, &secretsmanager.LookupSecretArgs{ 83 // Name: pulumi.StringRef("directconnect!prod/us-east-1/directconnect/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"), 84 // }, nil) 85 // if err != nil { 86 // return err 87 // } 88 // _, err = directconnect.NewMacsecKeyAssociation(ctx, "test", &directconnect.MacsecKeyAssociationArgs{ 89 // ConnectionId: pulumi.String(example.Id), 90 // SecretArn: pulumi.String(exampleGetSecret.Arn), 91 // }) 92 // if err != nil { 93 // return err 94 // } 95 // return nil 96 // }) 97 // } 98 // 99 // ``` 100 // <!--End PulumiCodeChooser --> 101 type MacsecKeyAssociation struct { 102 pulumi.CustomResourceState 103 104 // The MAC Security (MACsec) CAK to associate with the dedicated connection. The valid values are 64 hexadecimal characters (0-9, A-E). Required if using `ckn`. 105 Cak pulumi.StringPtrOutput `pulumi:"cak"` 106 // The MAC Security (MACsec) CKN to associate with the dedicated connection. The valid values are 64 hexadecimal characters (0-9, A-E). Required if using `cak`. 107 Ckn pulumi.StringOutput `pulumi:"ckn"` 108 // The ID of the dedicated Direct Connect connection. The connection must be a dedicated connection in the `AVAILABLE` state. 109 ConnectionId pulumi.StringOutput `pulumi:"connectionId"` 110 // The Amazon Resource Name (ARN) of the MAC Security (MACsec) secret key to associate with the dedicated connection. 111 // 112 // > **Note:** `ckn` and `cak` are mutually exclusive with `secretArn` - these arguments cannot be used together. If you use `ckn` and `cak`, you should not use `secretArn`. If you use the `secretArn` argument to reference an existing MAC Security (MACSec) secret key, you should not use `ckn` or `cak`. 113 SecretArn pulumi.StringOutput `pulumi:"secretArn"` 114 // The date in UTC format that the MAC Security (MACsec) secret key takes effect. 115 StartOn pulumi.StringOutput `pulumi:"startOn"` 116 // The state of the MAC Security (MACsec) secret key. The possible values are: associating, associated, disassociating, disassociated. See [MacSecKey](https://docs.aws.amazon.com/directconnect/latest/APIReference/API_MacSecKey.html#DX-Type-MacSecKey-state) for descriptions of each state. 117 State pulumi.StringOutput `pulumi:"state"` 118 } 119 120 // NewMacsecKeyAssociation registers a new resource with the given unique name, arguments, and options. 121 func NewMacsecKeyAssociation(ctx *pulumi.Context, 122 name string, args *MacsecKeyAssociationArgs, opts ...pulumi.ResourceOption) (*MacsecKeyAssociation, error) { 123 if args == nil { 124 return nil, errors.New("missing one or more required arguments") 125 } 126 127 if args.ConnectionId == nil { 128 return nil, errors.New("invalid value for required argument 'ConnectionId'") 129 } 130 opts = internal.PkgResourceDefaultOpts(opts) 131 var resource MacsecKeyAssociation 132 err := ctx.RegisterResource("aws:directconnect/macsecKeyAssociation:MacsecKeyAssociation", name, args, &resource, opts...) 133 if err != nil { 134 return nil, err 135 } 136 return &resource, nil 137 } 138 139 // GetMacsecKeyAssociation gets an existing MacsecKeyAssociation resource's state with the given name, ID, and optional 140 // state properties that are used to uniquely qualify the lookup (nil if not required). 141 func GetMacsecKeyAssociation(ctx *pulumi.Context, 142 name string, id pulumi.IDInput, state *MacsecKeyAssociationState, opts ...pulumi.ResourceOption) (*MacsecKeyAssociation, error) { 143 var resource MacsecKeyAssociation 144 err := ctx.ReadResource("aws:directconnect/macsecKeyAssociation:MacsecKeyAssociation", name, id, state, &resource, opts...) 145 if err != nil { 146 return nil, err 147 } 148 return &resource, nil 149 } 150 151 // Input properties used for looking up and filtering MacsecKeyAssociation resources. 152 type macsecKeyAssociationState struct { 153 // The MAC Security (MACsec) CAK to associate with the dedicated connection. The valid values are 64 hexadecimal characters (0-9, A-E). Required if using `ckn`. 154 Cak *string `pulumi:"cak"` 155 // The MAC Security (MACsec) CKN to associate with the dedicated connection. The valid values are 64 hexadecimal characters (0-9, A-E). Required if using `cak`. 156 Ckn *string `pulumi:"ckn"` 157 // The ID of the dedicated Direct Connect connection. The connection must be a dedicated connection in the `AVAILABLE` state. 158 ConnectionId *string `pulumi:"connectionId"` 159 // The Amazon Resource Name (ARN) of the MAC Security (MACsec) secret key to associate with the dedicated connection. 160 // 161 // > **Note:** `ckn` and `cak` are mutually exclusive with `secretArn` - these arguments cannot be used together. If you use `ckn` and `cak`, you should not use `secretArn`. If you use the `secretArn` argument to reference an existing MAC Security (MACSec) secret key, you should not use `ckn` or `cak`. 162 SecretArn *string `pulumi:"secretArn"` 163 // The date in UTC format that the MAC Security (MACsec) secret key takes effect. 164 StartOn *string `pulumi:"startOn"` 165 // The state of the MAC Security (MACsec) secret key. The possible values are: associating, associated, disassociating, disassociated. See [MacSecKey](https://docs.aws.amazon.com/directconnect/latest/APIReference/API_MacSecKey.html#DX-Type-MacSecKey-state) for descriptions of each state. 166 State *string `pulumi:"state"` 167 } 168 169 type MacsecKeyAssociationState struct { 170 // The MAC Security (MACsec) CAK to associate with the dedicated connection. The valid values are 64 hexadecimal characters (0-9, A-E). Required if using `ckn`. 171 Cak pulumi.StringPtrInput 172 // The MAC Security (MACsec) CKN to associate with the dedicated connection. The valid values are 64 hexadecimal characters (0-9, A-E). Required if using `cak`. 173 Ckn pulumi.StringPtrInput 174 // The ID of the dedicated Direct Connect connection. The connection must be a dedicated connection in the `AVAILABLE` state. 175 ConnectionId pulumi.StringPtrInput 176 // The Amazon Resource Name (ARN) of the MAC Security (MACsec) secret key to associate with the dedicated connection. 177 // 178 // > **Note:** `ckn` and `cak` are mutually exclusive with `secretArn` - these arguments cannot be used together. If you use `ckn` and `cak`, you should not use `secretArn`. If you use the `secretArn` argument to reference an existing MAC Security (MACSec) secret key, you should not use `ckn` or `cak`. 179 SecretArn pulumi.StringPtrInput 180 // The date in UTC format that the MAC Security (MACsec) secret key takes effect. 181 StartOn pulumi.StringPtrInput 182 // The state of the MAC Security (MACsec) secret key. The possible values are: associating, associated, disassociating, disassociated. See [MacSecKey](https://docs.aws.amazon.com/directconnect/latest/APIReference/API_MacSecKey.html#DX-Type-MacSecKey-state) for descriptions of each state. 183 State pulumi.StringPtrInput 184 } 185 186 func (MacsecKeyAssociationState) ElementType() reflect.Type { 187 return reflect.TypeOf((*macsecKeyAssociationState)(nil)).Elem() 188 } 189 190 type macsecKeyAssociationArgs struct { 191 // The MAC Security (MACsec) CAK to associate with the dedicated connection. The valid values are 64 hexadecimal characters (0-9, A-E). Required if using `ckn`. 192 Cak *string `pulumi:"cak"` 193 // The MAC Security (MACsec) CKN to associate with the dedicated connection. The valid values are 64 hexadecimal characters (0-9, A-E). Required if using `cak`. 194 Ckn *string `pulumi:"ckn"` 195 // The ID of the dedicated Direct Connect connection. The connection must be a dedicated connection in the `AVAILABLE` state. 196 ConnectionId string `pulumi:"connectionId"` 197 // The Amazon Resource Name (ARN) of the MAC Security (MACsec) secret key to associate with the dedicated connection. 198 // 199 // > **Note:** `ckn` and `cak` are mutually exclusive with `secretArn` - these arguments cannot be used together. If you use `ckn` and `cak`, you should not use `secretArn`. If you use the `secretArn` argument to reference an existing MAC Security (MACSec) secret key, you should not use `ckn` or `cak`. 200 SecretArn *string `pulumi:"secretArn"` 201 } 202 203 // The set of arguments for constructing a MacsecKeyAssociation resource. 204 type MacsecKeyAssociationArgs struct { 205 // The MAC Security (MACsec) CAK to associate with the dedicated connection. The valid values are 64 hexadecimal characters (0-9, A-E). Required if using `ckn`. 206 Cak pulumi.StringPtrInput 207 // The MAC Security (MACsec) CKN to associate with the dedicated connection. The valid values are 64 hexadecimal characters (0-9, A-E). Required if using `cak`. 208 Ckn pulumi.StringPtrInput 209 // The ID of the dedicated Direct Connect connection. The connection must be a dedicated connection in the `AVAILABLE` state. 210 ConnectionId pulumi.StringInput 211 // The Amazon Resource Name (ARN) of the MAC Security (MACsec) secret key to associate with the dedicated connection. 212 // 213 // > **Note:** `ckn` and `cak` are mutually exclusive with `secretArn` - these arguments cannot be used together. If you use `ckn` and `cak`, you should not use `secretArn`. If you use the `secretArn` argument to reference an existing MAC Security (MACSec) secret key, you should not use `ckn` or `cak`. 214 SecretArn pulumi.StringPtrInput 215 } 216 217 func (MacsecKeyAssociationArgs) ElementType() reflect.Type { 218 return reflect.TypeOf((*macsecKeyAssociationArgs)(nil)).Elem() 219 } 220 221 type MacsecKeyAssociationInput interface { 222 pulumi.Input 223 224 ToMacsecKeyAssociationOutput() MacsecKeyAssociationOutput 225 ToMacsecKeyAssociationOutputWithContext(ctx context.Context) MacsecKeyAssociationOutput 226 } 227 228 func (*MacsecKeyAssociation) ElementType() reflect.Type { 229 return reflect.TypeOf((**MacsecKeyAssociation)(nil)).Elem() 230 } 231 232 func (i *MacsecKeyAssociation) ToMacsecKeyAssociationOutput() MacsecKeyAssociationOutput { 233 return i.ToMacsecKeyAssociationOutputWithContext(context.Background()) 234 } 235 236 func (i *MacsecKeyAssociation) ToMacsecKeyAssociationOutputWithContext(ctx context.Context) MacsecKeyAssociationOutput { 237 return pulumi.ToOutputWithContext(ctx, i).(MacsecKeyAssociationOutput) 238 } 239 240 // MacsecKeyAssociationArrayInput is an input type that accepts MacsecKeyAssociationArray and MacsecKeyAssociationArrayOutput values. 241 // You can construct a concrete instance of `MacsecKeyAssociationArrayInput` via: 242 // 243 // MacsecKeyAssociationArray{ MacsecKeyAssociationArgs{...} } 244 type MacsecKeyAssociationArrayInput interface { 245 pulumi.Input 246 247 ToMacsecKeyAssociationArrayOutput() MacsecKeyAssociationArrayOutput 248 ToMacsecKeyAssociationArrayOutputWithContext(context.Context) MacsecKeyAssociationArrayOutput 249 } 250 251 type MacsecKeyAssociationArray []MacsecKeyAssociationInput 252 253 func (MacsecKeyAssociationArray) ElementType() reflect.Type { 254 return reflect.TypeOf((*[]*MacsecKeyAssociation)(nil)).Elem() 255 } 256 257 func (i MacsecKeyAssociationArray) ToMacsecKeyAssociationArrayOutput() MacsecKeyAssociationArrayOutput { 258 return i.ToMacsecKeyAssociationArrayOutputWithContext(context.Background()) 259 } 260 261 func (i MacsecKeyAssociationArray) ToMacsecKeyAssociationArrayOutputWithContext(ctx context.Context) MacsecKeyAssociationArrayOutput { 262 return pulumi.ToOutputWithContext(ctx, i).(MacsecKeyAssociationArrayOutput) 263 } 264 265 // MacsecKeyAssociationMapInput is an input type that accepts MacsecKeyAssociationMap and MacsecKeyAssociationMapOutput values. 266 // You can construct a concrete instance of `MacsecKeyAssociationMapInput` via: 267 // 268 // MacsecKeyAssociationMap{ "key": MacsecKeyAssociationArgs{...} } 269 type MacsecKeyAssociationMapInput interface { 270 pulumi.Input 271 272 ToMacsecKeyAssociationMapOutput() MacsecKeyAssociationMapOutput 273 ToMacsecKeyAssociationMapOutputWithContext(context.Context) MacsecKeyAssociationMapOutput 274 } 275 276 type MacsecKeyAssociationMap map[string]MacsecKeyAssociationInput 277 278 func (MacsecKeyAssociationMap) ElementType() reflect.Type { 279 return reflect.TypeOf((*map[string]*MacsecKeyAssociation)(nil)).Elem() 280 } 281 282 func (i MacsecKeyAssociationMap) ToMacsecKeyAssociationMapOutput() MacsecKeyAssociationMapOutput { 283 return i.ToMacsecKeyAssociationMapOutputWithContext(context.Background()) 284 } 285 286 func (i MacsecKeyAssociationMap) ToMacsecKeyAssociationMapOutputWithContext(ctx context.Context) MacsecKeyAssociationMapOutput { 287 return pulumi.ToOutputWithContext(ctx, i).(MacsecKeyAssociationMapOutput) 288 } 289 290 type MacsecKeyAssociationOutput struct{ *pulumi.OutputState } 291 292 func (MacsecKeyAssociationOutput) ElementType() reflect.Type { 293 return reflect.TypeOf((**MacsecKeyAssociation)(nil)).Elem() 294 } 295 296 func (o MacsecKeyAssociationOutput) ToMacsecKeyAssociationOutput() MacsecKeyAssociationOutput { 297 return o 298 } 299 300 func (o MacsecKeyAssociationOutput) ToMacsecKeyAssociationOutputWithContext(ctx context.Context) MacsecKeyAssociationOutput { 301 return o 302 } 303 304 // The MAC Security (MACsec) CAK to associate with the dedicated connection. The valid values are 64 hexadecimal characters (0-9, A-E). Required if using `ckn`. 305 func (o MacsecKeyAssociationOutput) Cak() pulumi.StringPtrOutput { 306 return o.ApplyT(func(v *MacsecKeyAssociation) pulumi.StringPtrOutput { return v.Cak }).(pulumi.StringPtrOutput) 307 } 308 309 // The MAC Security (MACsec) CKN to associate with the dedicated connection. The valid values are 64 hexadecimal characters (0-9, A-E). Required if using `cak`. 310 func (o MacsecKeyAssociationOutput) Ckn() pulumi.StringOutput { 311 return o.ApplyT(func(v *MacsecKeyAssociation) pulumi.StringOutput { return v.Ckn }).(pulumi.StringOutput) 312 } 313 314 // The ID of the dedicated Direct Connect connection. The connection must be a dedicated connection in the `AVAILABLE` state. 315 func (o MacsecKeyAssociationOutput) ConnectionId() pulumi.StringOutput { 316 return o.ApplyT(func(v *MacsecKeyAssociation) pulumi.StringOutput { return v.ConnectionId }).(pulumi.StringOutput) 317 } 318 319 // The Amazon Resource Name (ARN) of the MAC Security (MACsec) secret key to associate with the dedicated connection. 320 // 321 // > **Note:** `ckn` and `cak` are mutually exclusive with `secretArn` - these arguments cannot be used together. If you use `ckn` and `cak`, you should not use `secretArn`. If you use the `secretArn` argument to reference an existing MAC Security (MACSec) secret key, you should not use `ckn` or `cak`. 322 func (o MacsecKeyAssociationOutput) SecretArn() pulumi.StringOutput { 323 return o.ApplyT(func(v *MacsecKeyAssociation) pulumi.StringOutput { return v.SecretArn }).(pulumi.StringOutput) 324 } 325 326 // The date in UTC format that the MAC Security (MACsec) secret key takes effect. 327 func (o MacsecKeyAssociationOutput) StartOn() pulumi.StringOutput { 328 return o.ApplyT(func(v *MacsecKeyAssociation) pulumi.StringOutput { return v.StartOn }).(pulumi.StringOutput) 329 } 330 331 // The state of the MAC Security (MACsec) secret key. The possible values are: associating, associated, disassociating, disassociated. See [MacSecKey](https://docs.aws.amazon.com/directconnect/latest/APIReference/API_MacSecKey.html#DX-Type-MacSecKey-state) for descriptions of each state. 332 func (o MacsecKeyAssociationOutput) State() pulumi.StringOutput { 333 return o.ApplyT(func(v *MacsecKeyAssociation) pulumi.StringOutput { return v.State }).(pulumi.StringOutput) 334 } 335 336 type MacsecKeyAssociationArrayOutput struct{ *pulumi.OutputState } 337 338 func (MacsecKeyAssociationArrayOutput) ElementType() reflect.Type { 339 return reflect.TypeOf((*[]*MacsecKeyAssociation)(nil)).Elem() 340 } 341 342 func (o MacsecKeyAssociationArrayOutput) ToMacsecKeyAssociationArrayOutput() MacsecKeyAssociationArrayOutput { 343 return o 344 } 345 346 func (o MacsecKeyAssociationArrayOutput) ToMacsecKeyAssociationArrayOutputWithContext(ctx context.Context) MacsecKeyAssociationArrayOutput { 347 return o 348 } 349 350 func (o MacsecKeyAssociationArrayOutput) Index(i pulumi.IntInput) MacsecKeyAssociationOutput { 351 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *MacsecKeyAssociation { 352 return vs[0].([]*MacsecKeyAssociation)[vs[1].(int)] 353 }).(MacsecKeyAssociationOutput) 354 } 355 356 type MacsecKeyAssociationMapOutput struct{ *pulumi.OutputState } 357 358 func (MacsecKeyAssociationMapOutput) ElementType() reflect.Type { 359 return reflect.TypeOf((*map[string]*MacsecKeyAssociation)(nil)).Elem() 360 } 361 362 func (o MacsecKeyAssociationMapOutput) ToMacsecKeyAssociationMapOutput() MacsecKeyAssociationMapOutput { 363 return o 364 } 365 366 func (o MacsecKeyAssociationMapOutput) ToMacsecKeyAssociationMapOutputWithContext(ctx context.Context) MacsecKeyAssociationMapOutput { 367 return o 368 } 369 370 func (o MacsecKeyAssociationMapOutput) MapIndex(k pulumi.StringInput) MacsecKeyAssociationOutput { 371 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *MacsecKeyAssociation { 372 return vs[0].(map[string]*MacsecKeyAssociation)[vs[1].(string)] 373 }).(MacsecKeyAssociationOutput) 374 } 375 376 func init() { 377 pulumi.RegisterInputType(reflect.TypeOf((*MacsecKeyAssociationInput)(nil)).Elem(), &MacsecKeyAssociation{}) 378 pulumi.RegisterInputType(reflect.TypeOf((*MacsecKeyAssociationArrayInput)(nil)).Elem(), MacsecKeyAssociationArray{}) 379 pulumi.RegisterInputType(reflect.TypeOf((*MacsecKeyAssociationMapInput)(nil)).Elem(), MacsecKeyAssociationMap{}) 380 pulumi.RegisterOutputType(MacsecKeyAssociationOutput{}) 381 pulumi.RegisterOutputType(MacsecKeyAssociationArrayOutput{}) 382 pulumi.RegisterOutputType(MacsecKeyAssociationMapOutput{}) 383 }