Class Zone


  • public class Zone
    extends com.pulumi.resources.CustomResource
    Manages a Route53 Hosted Zone. For managing DNS Security Extensions (DNSSEC), see the `aws.route53.KeySigningKey` and `aws.route53.HostedZoneDnsSec` resources. ## Example Usage ### Public Zone
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.route53.Zone;
     import com.pulumi.aws.route53.ZoneArgs;
     import java.util.ArrayList;
     import java.util.Arrays;
     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 primary = new Zone("primary", ZoneArgs.builder()
                 .name("example.com")
                 .build());
     
         }
     }
     
     
    ### Public Subdomain Zone For use in subdomains, note that you need to create a `aws.route53.Record` of type `NS` as well as the subdomain zone.
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.route53.Zone;
     import com.pulumi.aws.route53.ZoneArgs;
     import com.pulumi.aws.route53.Record;
     import com.pulumi.aws.route53.RecordArgs;
     import java.util.ArrayList;
     import java.util.Arrays;
     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 main = new Zone("main", ZoneArgs.builder()
                 .name("example.com")
                 .build());
     
             var dev = new Zone("dev", ZoneArgs.builder()
                 .name("dev.example.com")
                 .tags(Map.of("Environment", "dev"))
                 .build());
     
             var dev_ns = new Record("dev-ns", RecordArgs.builder()
                 .zoneId(main.zoneId())
                 .name("dev.example.com")
                 .type("NS")
                 .ttl(30)
                 .records(dev.nameServers())
                 .build());
     
         }
     }
     
     
    ### Private Zone > **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 `aws.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 `aws.route53.ZoneAssociation` resource. > **NOTE:** Private zones require at least one VPC association at all times.
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.ec2.Vpc;
     import com.pulumi.aws.ec2.VpcArgs;
     import com.pulumi.aws.route53.Zone;
     import com.pulumi.aws.route53.ZoneArgs;
     import com.pulumi.aws.route53.inputs.ZoneVpcArgs;
     import java.util.ArrayList;
     import java.util.Arrays;
     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 primary = new Vpc("primary", VpcArgs.builder()
                 .cidrBlock("10.6.0.0/16")
                 .enableDnsHostnames(true)
                 .enableDnsSupport(true)
                 .build());
     
             var secondary = new Vpc("secondary", VpcArgs.builder()
                 .cidrBlock("10.7.0.0/16")
                 .enableDnsHostnames(true)
                 .enableDnsSupport(true)
                 .build());
     
             var private_ = new Zone("private", ZoneArgs.builder()
                 .vpcs(            
                     ZoneVpcArgs.builder()
                         .vpcId(primary.id())
                         .build(),
                     ZoneVpcArgs.builder()
                         .vpcId(secondary.id())
                         .build())
                 .name("example.com")
                 .build());
     
         }
     }
     
     
    ## Import ### Identity Schema #### Required * `zoneId` (String) The Hosted Zone ID. #### Optional * `accountId` (String) AWS Account where this resource is managed. Using `pulumi import`, import Route53 Zones using the zone `id`. For example: ```sh $ pulumi import aws:route53/zone:Zone myzone Z1D633PJN98FT9 ```
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.pulumi.resources.CustomResource

        com.pulumi.resources.CustomResource.CustomResourceInternal
      • Nested classes/interfaces inherited from class com.pulumi.resources.Resource

        com.pulumi.resources.Resource.LazyField<T extends java.lang.Object>, com.pulumi.resources.Resource.LazyFields, com.pulumi.resources.Resource.ResourceInternal
    • Field Summary

      • Fields inherited from class com.pulumi.resources.Resource

        childResources, remote
    • Constructor Summary

      Constructors 
      Constructor Description
      Zone​(java.lang.String name)  
      Zone​(java.lang.String name, ZoneArgs args)  
      Zone​(java.lang.String name, ZoneArgs args, com.pulumi.resources.CustomResourceOptions options)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.pulumi.core.Output<java.lang.String> arn()  
      com.pulumi.core.Output<java.lang.String> comment()  
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> delegationSetId()  
      com.pulumi.core.Output<java.lang.Boolean> enableAcceleratedRecovery()  
      com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> forceDestroy()  
      static Zone get​(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, ZoneState state, com.pulumi.resources.CustomResourceOptions options)
      Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
      com.pulumi.core.Output<java.lang.String> name()  
      com.pulumi.core.Output<java.util.List<java.lang.String>> nameServers()  
      com.pulumi.core.Output<java.lang.String> primaryNameServer()  
      com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> tags()  
      com.pulumi.core.Output<java.util.Map<java.lang.String,​java.lang.String>> tagsAll()  
      com.pulumi.core.Output<java.util.Optional<java.util.List<ZoneVpc>>> vpcs()  
      com.pulumi.core.Output<java.lang.String> zoneId()  
      • Methods inherited from class com.pulumi.resources.CustomResource

        getId, id, idFuture
      • Methods inherited from class com.pulumi.resources.Resource

        getChildResources, getResourceName, getResourceType, getUrn, pulumiChildResources, pulumiResourceName, pulumiResourceType, urn
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Zone

        public Zone​(java.lang.String name)
        Parameters:
        name - The _unique_ name of the resulting resource.
      • Zone

        public Zone​(java.lang.String name,
                    @Nullable
                    ZoneArgs args)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
      • Zone

        public Zone​(java.lang.String name,
                    @Nullable
                    ZoneArgs args,
                    @Nullable
                    com.pulumi.resources.CustomResourceOptions options)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
        options - A bag of options that control this resource's behavior.
    • Method Detail

      • arn

        public com.pulumi.core.Output<java.lang.String> arn()
        Returns:
        ARN of the Hosted Zone.
      • comment

        public com.pulumi.core.Output<java.lang.String> comment()
        Returns:
        A comment for the hosted zone. Defaults to 'Managed by Pulumi'.
      • delegationSetId

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> delegationSetId()
        Returns:
        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.
      • enableAcceleratedRecovery

        public com.pulumi.core.Output<java.lang.Boolean> enableAcceleratedRecovery()
        Returns:
        Boolean to indicate whether to enable accelerated recovery for the hosted zone. Defaults to `false`. Once set, switching to `false` requires explicitly specifying `false` rather than removing the argument.
      • forceDestroy

        public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> forceDestroy()
        Returns:
        Whether to destroy all records (possibly managed outside of this provider) in the zone when destroying the zone.
      • name

        public com.pulumi.core.Output<java.lang.String> name()
        Returns:
        This is the name of the hosted zone.
      • nameServers

        public com.pulumi.core.Output<java.util.List<java.lang.String>> nameServers()
        Returns:
        A list of name servers in associated (or default) delegation set. Find more about delegation sets in [AWS docs](https://docs.aws.amazon.com/Route53/latest/APIReference/actions-on-reusable-delegation-sets.html).
      • primaryNameServer

        public com.pulumi.core.Output<java.lang.String> primaryNameServer()
        Returns:
        The Route 53 name server that created the SOA record.
      • tags

        public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> tags()
        Returns:
        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.
      • tagsAll

        public com.pulumi.core.Output<java.util.Map<java.lang.String,​java.lang.String>> tagsAll()
        Returns:
        A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
      • vpcs

        public com.pulumi.core.Output<java.util.Optional<java.util.List<ZoneVpc>>> vpcs()
        Returns:
        Configuration block(s) specifying VPC(s) to associate with a private hosted zone. Conflicts with the `delegationSetId` argument in this resource and any `aws.route53.ZoneAssociation` resource specifying the same zone ID. Detailed below.
      • zoneId

        public com.pulumi.core.Output<java.lang.String> zoneId()
        Returns:
        The Hosted Zone ID. This can be referenced by zone records.
      • get

        public static Zone get​(java.lang.String name,
                               com.pulumi.core.Output<java.lang.String> id,
                               @Nullable
                               ZoneState state,
                               @Nullable
                               com.pulumi.resources.CustomResourceOptions options)
        Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
        Parameters:
        name - The _unique_ name of the resulting resource.
        id - The _unique_ provider ID of the resource to lookup.
        state -
        options - Optional settings to control the behavior of the CustomResource.