github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/route53/zone.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 route53 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 // Manages a Route53 Hosted Zone. For managing Domain Name System Security Extensions (DNSSEC), see the `route53.KeySigningKey` and `route53.HostedZoneDnsSec` resources. 15 // 16 // ## Example Usage 17 // 18 // ### Public Zone 19 // 20 // <!--Start PulumiCodeChooser --> 21 // ```go 22 // package main 23 // 24 // import ( 25 // 26 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/route53" 27 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 28 // 29 // ) 30 // 31 // func main() { 32 // pulumi.Run(func(ctx *pulumi.Context) error { 33 // _, err := route53.NewZone(ctx, "primary", &route53.ZoneArgs{ 34 // Name: pulumi.String("example.com"), 35 // }) 36 // if err != nil { 37 // return err 38 // } 39 // return nil 40 // }) 41 // } 42 // 43 // ``` 44 // <!--End PulumiCodeChooser --> 45 // 46 // ### Public Subdomain Zone 47 // 48 // For use in subdomains, note that you need to create a 49 // `route53.Record` of type `NS` as well as the subdomain 50 // zone. 51 // 52 // <!--Start PulumiCodeChooser --> 53 // ```go 54 // package main 55 // 56 // import ( 57 // 58 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/route53" 59 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 60 // 61 // ) 62 // 63 // func main() { 64 // pulumi.Run(func(ctx *pulumi.Context) error { 65 // main, err := route53.NewZone(ctx, "main", &route53.ZoneArgs{ 66 // Name: pulumi.String("example.com"), 67 // }) 68 // if err != nil { 69 // return err 70 // } 71 // dev, err := route53.NewZone(ctx, "dev", &route53.ZoneArgs{ 72 // Name: pulumi.String("dev.example.com"), 73 // Tags: pulumi.StringMap{ 74 // "Environment": pulumi.String("dev"), 75 // }, 76 // }) 77 // if err != nil { 78 // return err 79 // } 80 // _, err = route53.NewRecord(ctx, "dev-ns", &route53.RecordArgs{ 81 // ZoneId: main.ZoneId, 82 // Name: pulumi.String("dev.example.com"), 83 // Type: pulumi.String(route53.RecordTypeNS), 84 // Ttl: pulumi.Int(30), 85 // Records: dev.NameServers, 86 // }) 87 // if err != nil { 88 // return err 89 // } 90 // return nil 91 // }) 92 // } 93 // 94 // ``` 95 // <!--End PulumiCodeChooser --> 96 // 97 // ### Private Zone 98 // 99 // > **NOTE:** This provider provides both exclusive VPC associations defined in-line in this resource via `vpc` configuration blocks and a separate ` Zone VPC Association resource. At this time, you cannot use in-line VPC associations in conjunction with any `route53.ZoneAssociation` resources with the same zone ID otherwise it will cause a perpetual difference in plan output. You can optionally use [ `ignoreChanges` ](https://www.pulumi.com/docs/intro/concepts/programming-model/#ignorechanges) to manage additional associations via the `route53.ZoneAssociation` resource. 100 // 101 // > **NOTE:** Private zones require at least one VPC association at all times. 102 // 103 // <!--Start PulumiCodeChooser --> 104 // ```go 105 // package main 106 // 107 // import ( 108 // 109 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/route53" 110 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 111 // 112 // ) 113 // 114 // func main() { 115 // pulumi.Run(func(ctx *pulumi.Context) error { 116 // _, err := route53.NewZone(ctx, "private", &route53.ZoneArgs{ 117 // Name: pulumi.String("example.com"), 118 // Vpcs: route53.ZoneVpcArray{ 119 // &route53.ZoneVpcArgs{ 120 // VpcId: pulumi.Any(example.Id), 121 // }, 122 // }, 123 // }) 124 // if err != nil { 125 // return err 126 // } 127 // return nil 128 // }) 129 // } 130 // 131 // ``` 132 // <!--End PulumiCodeChooser --> 133 // 134 // ## Import 135 // 136 // Using `pulumi import`, import Route53 Zones using the zone `id`. For example: 137 // 138 // ```sh 139 // $ pulumi import aws:route53/zone:Zone myzone Z1D633PJN98FT9 140 // ``` 141 type Zone struct { 142 pulumi.CustomResourceState 143 144 // The Amazon Resource Name (ARN) of the Hosted Zone. 145 Arn pulumi.StringOutput `pulumi:"arn"` 146 // A comment for the hosted zone. Defaults to 'Managed by Pulumi'. 147 Comment pulumi.StringOutput `pulumi:"comment"` 148 // The ID of the reusable delegation set whose NS records you want to assign to the hosted zone. Conflicts with `vpc` as delegation sets can only be used for public zones. 149 DelegationSetId pulumi.StringPtrOutput `pulumi:"delegationSetId"` 150 // Whether to destroy all records (possibly managed outside of this provider) in the zone when destroying the zone. 151 ForceDestroy pulumi.BoolPtrOutput `pulumi:"forceDestroy"` 152 // This is the name of the hosted zone. 153 Name pulumi.StringOutput `pulumi:"name"` 154 // A list of name servers in associated (or default) delegation set. 155 // Find more about delegation sets in [AWS docs](https://docs.aws.amazon.com/Route53/latest/APIReference/actions-on-reusable-delegation-sets.html). 156 NameServers pulumi.StringArrayOutput `pulumi:"nameServers"` 157 // The Route 53 name server that created the SOA record. 158 PrimaryNameServer pulumi.StringOutput `pulumi:"primaryNameServer"` 159 // A mapping of tags to assign to the zone. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 160 Tags pulumi.StringMapOutput `pulumi:"tags"` 161 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 162 // 163 // Deprecated: Please use `tags` instead. 164 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 165 // Configuration block(s) specifying VPC(s) to associate with a private hosted zone. Conflicts with the `delegationSetId` argument in this resource and any `route53.ZoneAssociation` resource specifying the same zone ID. Detailed below. 166 Vpcs ZoneVpcArrayOutput `pulumi:"vpcs"` 167 // The Hosted Zone ID. This can be referenced by zone records. 168 ZoneId pulumi.StringOutput `pulumi:"zoneId"` 169 } 170 171 // NewZone registers a new resource with the given unique name, arguments, and options. 172 func NewZone(ctx *pulumi.Context, 173 name string, args *ZoneArgs, opts ...pulumi.ResourceOption) (*Zone, error) { 174 if args == nil { 175 args = &ZoneArgs{} 176 } 177 178 if args.Comment == nil { 179 args.Comment = pulumi.StringPtr("Managed by Pulumi") 180 } 181 opts = internal.PkgResourceDefaultOpts(opts) 182 var resource Zone 183 err := ctx.RegisterResource("aws:route53/zone:Zone", name, args, &resource, opts...) 184 if err != nil { 185 return nil, err 186 } 187 return &resource, nil 188 } 189 190 // GetZone gets an existing Zone resource's state with the given name, ID, and optional 191 // state properties that are used to uniquely qualify the lookup (nil if not required). 192 func GetZone(ctx *pulumi.Context, 193 name string, id pulumi.IDInput, state *ZoneState, opts ...pulumi.ResourceOption) (*Zone, error) { 194 var resource Zone 195 err := ctx.ReadResource("aws:route53/zone:Zone", name, id, state, &resource, opts...) 196 if err != nil { 197 return nil, err 198 } 199 return &resource, nil 200 } 201 202 // Input properties used for looking up and filtering Zone resources. 203 type zoneState struct { 204 // The Amazon Resource Name (ARN) of the Hosted Zone. 205 Arn *string `pulumi:"arn"` 206 // A comment for the hosted zone. Defaults to 'Managed by Pulumi'. 207 Comment *string `pulumi:"comment"` 208 // The ID of the reusable delegation set whose NS records you want to assign to the hosted zone. Conflicts with `vpc` as delegation sets can only be used for public zones. 209 DelegationSetId *string `pulumi:"delegationSetId"` 210 // Whether to destroy all records (possibly managed outside of this provider) in the zone when destroying the zone. 211 ForceDestroy *bool `pulumi:"forceDestroy"` 212 // This is the name of the hosted zone. 213 Name *string `pulumi:"name"` 214 // A list of name servers in associated (or default) delegation set. 215 // Find more about delegation sets in [AWS docs](https://docs.aws.amazon.com/Route53/latest/APIReference/actions-on-reusable-delegation-sets.html). 216 NameServers []string `pulumi:"nameServers"` 217 // The Route 53 name server that created the SOA record. 218 PrimaryNameServer *string `pulumi:"primaryNameServer"` 219 // A mapping of tags to assign to the zone. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 220 Tags map[string]string `pulumi:"tags"` 221 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 222 // 223 // Deprecated: Please use `tags` instead. 224 TagsAll map[string]string `pulumi:"tagsAll"` 225 // Configuration block(s) specifying VPC(s) to associate with a private hosted zone. Conflicts with the `delegationSetId` argument in this resource and any `route53.ZoneAssociation` resource specifying the same zone ID. Detailed below. 226 Vpcs []ZoneVpc `pulumi:"vpcs"` 227 // The Hosted Zone ID. This can be referenced by zone records. 228 ZoneId *string `pulumi:"zoneId"` 229 } 230 231 type ZoneState struct { 232 // The Amazon Resource Name (ARN) of the Hosted Zone. 233 Arn pulumi.StringPtrInput 234 // A comment for the hosted zone. Defaults to 'Managed by Pulumi'. 235 Comment pulumi.StringPtrInput 236 // The ID of the reusable delegation set whose NS records you want to assign to the hosted zone. Conflicts with `vpc` as delegation sets can only be used for public zones. 237 DelegationSetId pulumi.StringPtrInput 238 // Whether to destroy all records (possibly managed outside of this provider) in the zone when destroying the zone. 239 ForceDestroy pulumi.BoolPtrInput 240 // This is the name of the hosted zone. 241 Name pulumi.StringPtrInput 242 // A list of name servers in associated (or default) delegation set. 243 // Find more about delegation sets in [AWS docs](https://docs.aws.amazon.com/Route53/latest/APIReference/actions-on-reusable-delegation-sets.html). 244 NameServers pulumi.StringArrayInput 245 // The Route 53 name server that created the SOA record. 246 PrimaryNameServer pulumi.StringPtrInput 247 // A mapping of tags to assign to the zone. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 248 Tags pulumi.StringMapInput 249 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 250 // 251 // Deprecated: Please use `tags` instead. 252 TagsAll pulumi.StringMapInput 253 // Configuration block(s) specifying VPC(s) to associate with a private hosted zone. Conflicts with the `delegationSetId` argument in this resource and any `route53.ZoneAssociation` resource specifying the same zone ID. Detailed below. 254 Vpcs ZoneVpcArrayInput 255 // The Hosted Zone ID. This can be referenced by zone records. 256 ZoneId pulumi.StringPtrInput 257 } 258 259 func (ZoneState) ElementType() reflect.Type { 260 return reflect.TypeOf((*zoneState)(nil)).Elem() 261 } 262 263 type zoneArgs struct { 264 // A comment for the hosted zone. Defaults to 'Managed by Pulumi'. 265 Comment *string `pulumi:"comment"` 266 // The ID of the reusable delegation set whose NS records you want to assign to the hosted zone. Conflicts with `vpc` as delegation sets can only be used for public zones. 267 DelegationSetId *string `pulumi:"delegationSetId"` 268 // Whether to destroy all records (possibly managed outside of this provider) in the zone when destroying the zone. 269 ForceDestroy *bool `pulumi:"forceDestroy"` 270 // This is the name of the hosted zone. 271 Name *string `pulumi:"name"` 272 // A mapping of tags to assign to the zone. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 273 Tags map[string]string `pulumi:"tags"` 274 // Configuration block(s) specifying VPC(s) to associate with a private hosted zone. Conflicts with the `delegationSetId` argument in this resource and any `route53.ZoneAssociation` resource specifying the same zone ID. Detailed below. 275 Vpcs []ZoneVpc `pulumi:"vpcs"` 276 } 277 278 // The set of arguments for constructing a Zone resource. 279 type ZoneArgs struct { 280 // A comment for the hosted zone. Defaults to 'Managed by Pulumi'. 281 Comment pulumi.StringPtrInput 282 // The ID of the reusable delegation set whose NS records you want to assign to the hosted zone. Conflicts with `vpc` as delegation sets can only be used for public zones. 283 DelegationSetId pulumi.StringPtrInput 284 // Whether to destroy all records (possibly managed outside of this provider) in the zone when destroying the zone. 285 ForceDestroy pulumi.BoolPtrInput 286 // This is the name of the hosted zone. 287 Name pulumi.StringPtrInput 288 // A mapping of tags to assign to the zone. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 289 Tags pulumi.StringMapInput 290 // Configuration block(s) specifying VPC(s) to associate with a private hosted zone. Conflicts with the `delegationSetId` argument in this resource and any `route53.ZoneAssociation` resource specifying the same zone ID. Detailed below. 291 Vpcs ZoneVpcArrayInput 292 } 293 294 func (ZoneArgs) ElementType() reflect.Type { 295 return reflect.TypeOf((*zoneArgs)(nil)).Elem() 296 } 297 298 type ZoneInput interface { 299 pulumi.Input 300 301 ToZoneOutput() ZoneOutput 302 ToZoneOutputWithContext(ctx context.Context) ZoneOutput 303 } 304 305 func (*Zone) ElementType() reflect.Type { 306 return reflect.TypeOf((**Zone)(nil)).Elem() 307 } 308 309 func (i *Zone) ToZoneOutput() ZoneOutput { 310 return i.ToZoneOutputWithContext(context.Background()) 311 } 312 313 func (i *Zone) ToZoneOutputWithContext(ctx context.Context) ZoneOutput { 314 return pulumi.ToOutputWithContext(ctx, i).(ZoneOutput) 315 } 316 317 // ZoneArrayInput is an input type that accepts ZoneArray and ZoneArrayOutput values. 318 // You can construct a concrete instance of `ZoneArrayInput` via: 319 // 320 // ZoneArray{ ZoneArgs{...} } 321 type ZoneArrayInput interface { 322 pulumi.Input 323 324 ToZoneArrayOutput() ZoneArrayOutput 325 ToZoneArrayOutputWithContext(context.Context) ZoneArrayOutput 326 } 327 328 type ZoneArray []ZoneInput 329 330 func (ZoneArray) ElementType() reflect.Type { 331 return reflect.TypeOf((*[]*Zone)(nil)).Elem() 332 } 333 334 func (i ZoneArray) ToZoneArrayOutput() ZoneArrayOutput { 335 return i.ToZoneArrayOutputWithContext(context.Background()) 336 } 337 338 func (i ZoneArray) ToZoneArrayOutputWithContext(ctx context.Context) ZoneArrayOutput { 339 return pulumi.ToOutputWithContext(ctx, i).(ZoneArrayOutput) 340 } 341 342 // ZoneMapInput is an input type that accepts ZoneMap and ZoneMapOutput values. 343 // You can construct a concrete instance of `ZoneMapInput` via: 344 // 345 // ZoneMap{ "key": ZoneArgs{...} } 346 type ZoneMapInput interface { 347 pulumi.Input 348 349 ToZoneMapOutput() ZoneMapOutput 350 ToZoneMapOutputWithContext(context.Context) ZoneMapOutput 351 } 352 353 type ZoneMap map[string]ZoneInput 354 355 func (ZoneMap) ElementType() reflect.Type { 356 return reflect.TypeOf((*map[string]*Zone)(nil)).Elem() 357 } 358 359 func (i ZoneMap) ToZoneMapOutput() ZoneMapOutput { 360 return i.ToZoneMapOutputWithContext(context.Background()) 361 } 362 363 func (i ZoneMap) ToZoneMapOutputWithContext(ctx context.Context) ZoneMapOutput { 364 return pulumi.ToOutputWithContext(ctx, i).(ZoneMapOutput) 365 } 366 367 type ZoneOutput struct{ *pulumi.OutputState } 368 369 func (ZoneOutput) ElementType() reflect.Type { 370 return reflect.TypeOf((**Zone)(nil)).Elem() 371 } 372 373 func (o ZoneOutput) ToZoneOutput() ZoneOutput { 374 return o 375 } 376 377 func (o ZoneOutput) ToZoneOutputWithContext(ctx context.Context) ZoneOutput { 378 return o 379 } 380 381 // The Amazon Resource Name (ARN) of the Hosted Zone. 382 func (o ZoneOutput) Arn() pulumi.StringOutput { 383 return o.ApplyT(func(v *Zone) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 384 } 385 386 // A comment for the hosted zone. Defaults to 'Managed by Pulumi'. 387 func (o ZoneOutput) Comment() pulumi.StringOutput { 388 return o.ApplyT(func(v *Zone) pulumi.StringOutput { return v.Comment }).(pulumi.StringOutput) 389 } 390 391 // The ID of the reusable delegation set whose NS records you want to assign to the hosted zone. Conflicts with `vpc` as delegation sets can only be used for public zones. 392 func (o ZoneOutput) DelegationSetId() pulumi.StringPtrOutput { 393 return o.ApplyT(func(v *Zone) pulumi.StringPtrOutput { return v.DelegationSetId }).(pulumi.StringPtrOutput) 394 } 395 396 // Whether to destroy all records (possibly managed outside of this provider) in the zone when destroying the zone. 397 func (o ZoneOutput) ForceDestroy() pulumi.BoolPtrOutput { 398 return o.ApplyT(func(v *Zone) pulumi.BoolPtrOutput { return v.ForceDestroy }).(pulumi.BoolPtrOutput) 399 } 400 401 // This is the name of the hosted zone. 402 func (o ZoneOutput) Name() pulumi.StringOutput { 403 return o.ApplyT(func(v *Zone) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) 404 } 405 406 // A list of name servers in associated (or default) delegation set. 407 // Find more about delegation sets in [AWS docs](https://docs.aws.amazon.com/Route53/latest/APIReference/actions-on-reusable-delegation-sets.html). 408 func (o ZoneOutput) NameServers() pulumi.StringArrayOutput { 409 return o.ApplyT(func(v *Zone) pulumi.StringArrayOutput { return v.NameServers }).(pulumi.StringArrayOutput) 410 } 411 412 // The Route 53 name server that created the SOA record. 413 func (o ZoneOutput) PrimaryNameServer() pulumi.StringOutput { 414 return o.ApplyT(func(v *Zone) pulumi.StringOutput { return v.PrimaryNameServer }).(pulumi.StringOutput) 415 } 416 417 // A mapping of tags to assign to the zone. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 418 func (o ZoneOutput) Tags() pulumi.StringMapOutput { 419 return o.ApplyT(func(v *Zone) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 420 } 421 422 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 423 // 424 // Deprecated: Please use `tags` instead. 425 func (o ZoneOutput) TagsAll() pulumi.StringMapOutput { 426 return o.ApplyT(func(v *Zone) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 427 } 428 429 // Configuration block(s) specifying VPC(s) to associate with a private hosted zone. Conflicts with the `delegationSetId` argument in this resource and any `route53.ZoneAssociation` resource specifying the same zone ID. Detailed below. 430 func (o ZoneOutput) Vpcs() ZoneVpcArrayOutput { 431 return o.ApplyT(func(v *Zone) ZoneVpcArrayOutput { return v.Vpcs }).(ZoneVpcArrayOutput) 432 } 433 434 // The Hosted Zone ID. This can be referenced by zone records. 435 func (o ZoneOutput) ZoneId() pulumi.StringOutput { 436 return o.ApplyT(func(v *Zone) pulumi.StringOutput { return v.ZoneId }).(pulumi.StringOutput) 437 } 438 439 type ZoneArrayOutput struct{ *pulumi.OutputState } 440 441 func (ZoneArrayOutput) ElementType() reflect.Type { 442 return reflect.TypeOf((*[]*Zone)(nil)).Elem() 443 } 444 445 func (o ZoneArrayOutput) ToZoneArrayOutput() ZoneArrayOutput { 446 return o 447 } 448 449 func (o ZoneArrayOutput) ToZoneArrayOutputWithContext(ctx context.Context) ZoneArrayOutput { 450 return o 451 } 452 453 func (o ZoneArrayOutput) Index(i pulumi.IntInput) ZoneOutput { 454 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Zone { 455 return vs[0].([]*Zone)[vs[1].(int)] 456 }).(ZoneOutput) 457 } 458 459 type ZoneMapOutput struct{ *pulumi.OutputState } 460 461 func (ZoneMapOutput) ElementType() reflect.Type { 462 return reflect.TypeOf((*map[string]*Zone)(nil)).Elem() 463 } 464 465 func (o ZoneMapOutput) ToZoneMapOutput() ZoneMapOutput { 466 return o 467 } 468 469 func (o ZoneMapOutput) ToZoneMapOutputWithContext(ctx context.Context) ZoneMapOutput { 470 return o 471 } 472 473 func (o ZoneMapOutput) MapIndex(k pulumi.StringInput) ZoneOutput { 474 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Zone { 475 return vs[0].(map[string]*Zone)[vs[1].(string)] 476 }).(ZoneOutput) 477 } 478 479 func init() { 480 pulumi.RegisterInputType(reflect.TypeOf((*ZoneInput)(nil)).Elem(), &Zone{}) 481 pulumi.RegisterInputType(reflect.TypeOf((*ZoneArrayInput)(nil)).Elem(), ZoneArray{}) 482 pulumi.RegisterInputType(reflect.TypeOf((*ZoneMapInput)(nil)).Elem(), ZoneMap{}) 483 pulumi.RegisterOutputType(ZoneOutput{}) 484 pulumi.RegisterOutputType(ZoneArrayOutput{}) 485 pulumi.RegisterOutputType(ZoneMapOutput{}) 486 }