Class Record


  • public class Record
    extends com.pulumi.resources.CustomResource
    Provides a Route53 record resource. ## Example Usage ### Simple Routing Policy
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     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 www = new Record("www", RecordArgs.builder()
                 .zoneId(primary.zoneId())
                 .name("www.example.com")
                 .type("A")
                 .ttl(300)
                 .records(lb.publicIp())
                 .build());
     
         }
     }
     
     
    ### Weighted Routing Policy Other routing policies are configured similarly. See [Amazon Route 53 Developer Guide](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-policy.html) for details.
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.route53.Record;
     import com.pulumi.aws.route53.RecordArgs;
     import com.pulumi.aws.route53.inputs.RecordWeightedRoutingPolicyArgs;
     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 www_dev = new Record("www-dev", RecordArgs.builder()
                 .weightedRoutingPolicies(RecordWeightedRoutingPolicyArgs.builder()
                     .weight(10)
                     .build())
                 .zoneId(primary.zoneId())
                 .name("www")
                 .type("CNAME")
                 .ttl(5)
                 .setIdentifier("dev")
                 .records("dev.example.com")
                 .build());
     
             var www_live = new Record("www-live", RecordArgs.builder()
                 .weightedRoutingPolicies(RecordWeightedRoutingPolicyArgs.builder()
                     .weight(90)
                     .build())
                 .zoneId(primary.zoneId())
                 .name("www")
                 .type("CNAME")
                 .ttl(5)
                 .setIdentifier("live")
                 .records("live.example.com")
                 .build());
     
         }
     }
     
     
    ### Geoproximity Routing Policy
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.route53.Record;
     import com.pulumi.aws.route53.RecordArgs;
     import com.pulumi.aws.route53.inputs.RecordGeoproximityRoutingPolicyArgs;
     import com.pulumi.aws.route53.inputs.RecordGeoproximityRoutingPolicyCoordinateArgs;
     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 www = new Record("www", RecordArgs.builder()
                 .geoproximityRoutingPolicy(RecordGeoproximityRoutingPolicyArgs.builder()
                     .coordinates(RecordGeoproximityRoutingPolicyCoordinateArgs.builder()
                         .latitude("49.22")
                         .longitude("-74.01")
                         .build())
                     .build())
                 .zoneId(primary.zoneId())
                 .name("www.example.com")
                 .type("CNAME")
                 .ttl(300)
                 .setIdentifier("dev")
                 .records("dev.example.com")
                 .build());
     
         }
     }
     
     
    ### Alias Record See [related part of Amazon Route 53 Developer Guide](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/resource-record-sets-choosing-alias-non-alias.html) to understand differences between alias and non-alias records. TTL for all alias records is [60 seconds](https://aws.amazon.com/route53/faqs/#dns_failover_do_i_need_to_adjust), you cannot change this, therefore `ttl` has to be omitted in alias records.
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.elb.LoadBalancer;
     import com.pulumi.aws.elb.LoadBalancerArgs;
     import com.pulumi.aws.elb.inputs.LoadBalancerListenerArgs;
     import com.pulumi.aws.route53.Record;
     import com.pulumi.aws.route53.RecordArgs;
     import com.pulumi.aws.route53.inputs.RecordAliasArgs;
     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 LoadBalancer("main", LoadBalancerArgs.builder()
                 .listeners(LoadBalancerListenerArgs.builder()
                     .instancePort(80)
                     .instanceProtocol("http")
                     .lbPort(80)
                     .lbProtocol("http")
                     .build())
                 .name("foobar-elb")
                 .availabilityZones("us-east-1c")
                 .build());
     
             var www = new Record("www", RecordArgs.builder()
                 .aliases(RecordAliasArgs.builder()
                     .name(main.dnsName())
                     .zoneId(main.zoneId())
                     .evaluateTargetHealth(true)
                     .build())
                 .zoneId(primary.zoneId())
                 .name("example.com")
                 .type("A")
                 .build());
     
         }
     }
     
     
    ### Alias Record for AWS Global Accelerator
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.globalaccelerator.Accelerator;
     import com.pulumi.aws.globalaccelerator.AcceleratorArgs;
     import com.pulumi.aws.route53.Record;
     import com.pulumi.aws.route53.RecordArgs;
     import com.pulumi.aws.route53.inputs.RecordAliasArgs;
     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 Accelerator("main", AcceleratorArgs.builder()
                 .name("foobar-pulumi-accelerator")
                 .enabled(true)
                 .ipAddressType("IPV4")
                 .build());
     
             var www = new Record("www", RecordArgs.builder()
                 .aliases(RecordAliasArgs.builder()
                     .name(main.dnsName())
                     .zoneId(main.hostedZoneId())
                     .evaluateTargetHealth(false)
                     .build())
                 .zoneId(primary.zoneId())
                 .name("example.com")
                 .type("A")
                 .build());
     
         }
     }
     
     
    ### NS and SOA Record Management When creating Route 53 zones, the `NS` and `SOA` records for the zone are automatically created. Enabling the `allowOverwrite` argument will allow managing these records in a single deployment without the requirement for `import`.
     
     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 example = new Zone("example", ZoneArgs.builder()
                 .name("test.example.com")
                 .build());
     
             var exampleRecord = new Record("exampleRecord", RecordArgs.builder()
                 .allowOverwrite(true)
                 .name("test.example.com")
                 .ttl(172800)
                 .type("NS")
                 .zoneId(example.zoneId())
                 .records(            
                     example.nameServers().applyValue(_nameServers -> _nameServers[0]),
                     example.nameServers().applyValue(_nameServers -> _nameServers[1]),
                     example.nameServers().applyValue(_nameServers -> _nameServers[2]),
                     example.nameServers().applyValue(_nameServers -> _nameServers[3]))
                 .build());
     
         }
     }
     
     
    ### Caching Read Results > Cached reads is an experimental feature. The behavior may change without notice, and it is not subject to the backwards compatibility guarantee of the provider. Please provide feedback on this tracking issue. AWS Route53 enforces API [rate limits](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html#limits-api-requests) at the account level. Configurations that manage many records in the same account may trigger throttling and cause slow `plan` and `apply` times because each record resource issues its own API call during read/write operations. Setting the `TF_AWS_ROUTE53_RECORD_BATCH_READS` environment variable to `true` causes the provider to fetch all records for hosted zones referenced by `aws.route53.Record` once and cache the results in memory for the duration of the `plan` or `apply`, regardless of how many records are managed. No per-resource configuration is required. > **Warning:** When `TF_AWS_ROUTE53_RECORD_BATCH_READS` is set to a true value, the provider caches a zone's full record set the first time a record in that zone is read, then serves all subsequent reads from that cache. The caching layer ensures removal of cache entries for any records that are updated during an `apply` operation; however, any changes made to records outside of Pulumi (e.g. via the AWS Console or CLI) after the cache is populated will not be detected. ## Import ### Identity Schema #### Required * `zoneId` (String) Hosted zone ID for the record. * `name` (String) Name of the record. * `type` (String) Record type. #### Optional * `accountId` (String) AWS Account where this resource is managed. * `setIdentifier` (String) Set identifier for the record. If the record also contains a set identifier, append it: If the record name is the empty string, it can be omitted: **Using `pulumi import` to import** Route53 Records using the hosted zone ID, record name, record type, and set identifier. For example: Using the hosted zone ID, record name, and record type, separated by underscores (`_`): ```sh $ pulumi import aws:route53/record:Record example Z4KAPRWWNC7JR_dev_NS ``` If the record also contains a set identifier, append it: ```sh $ pulumi import aws:route53/record:Record example Z4KAPRWWNC7JR_dev_NS_dev ```
    • 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
      Record​(java.lang.String name)  
      Record​(java.lang.String name, RecordArgs args)  
      Record​(java.lang.String name, RecordArgs args, com.pulumi.resources.CustomResourceOptions options)  
    • Constructor Detail

      • Record

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

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

        public Record​(java.lang.String name,
                      RecordArgs 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

      • aliases

        public com.pulumi.core.Output<java.util.Optional<java.util.List<RecordAlias>>> aliases()
        Returns:
        An alias block. Conflicts with `ttl` & `records`. Documented below.
      • allowOverwrite

        public com.pulumi.core.Output<java.lang.Boolean> allowOverwrite()
        Returns:
        Allow creation of this record to overwrite an existing record, if any. This does not affect the ability to update the record using this provider and does not prevent other resources within this provider or manual Route 53 changes outside this provider from overwriting this record. `false` by default. This configuration is not recommended for most environments. Exactly one of `records` or `alias` must be specified: this determines whether it's an alias record.
      • cidrRoutingPolicy

        public com.pulumi.core.Output<java.util.Optional<RecordCidrRoutingPolicy>> cidrRoutingPolicy()
        Returns:
        A block indicating a routing policy based on the IP network ranges of requestors. Conflicts with any other routing policy. Documented below.
      • failoverRoutingPolicies

        public com.pulumi.core.Output<java.util.Optional<java.util.List<RecordFailoverRoutingPolicy>>> failoverRoutingPolicies()
        Returns:
        A block indicating the routing behavior when associated health check fails. Conflicts with any other routing policy. Documented below.
      • fqdn

        public com.pulumi.core.Output<java.lang.String> fqdn()
        Returns:
        [FQDN](https://en.wikipedia.org/wiki/Fully_qualified_domain_name) built using the zone domain and `name`. Does not include trailing `.`.
      • geolocationRoutingPolicies

        public com.pulumi.core.Output<java.util.Optional<java.util.List<RecordGeolocationRoutingPolicy>>> geolocationRoutingPolicies()
        Returns:
        A block indicating a routing policy based on the geolocation of the requestor. Conflicts with any other routing policy. Documented below.
      • geoproximityRoutingPolicy

        public com.pulumi.core.Output<java.util.Optional<RecordGeoproximityRoutingPolicy>> geoproximityRoutingPolicy()
        Returns:
        A block indicating a routing policy based on the geoproximity of the requestor. Conflicts with any other routing policy. Documented below.
      • healthCheckId

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> healthCheckId()
        Returns:
        The health check the record should be associated with.
      • latencyRoutingPolicies

        public com.pulumi.core.Output<java.util.Optional<java.util.List<RecordLatencyRoutingPolicy>>> latencyRoutingPolicies()
        Returns:
        A block indicating a routing policy based on the latency between the requestor and an AWS region. Conflicts with any other routing policy. Documented below.
      • multivalueAnswerRoutingPolicy

        public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> multivalueAnswerRoutingPolicy()
        Returns:
        Set to `true` to indicate a multivalue answer routing policy. Conflicts with any other routing policy.
      • name

        public com.pulumi.core.Output<java.lang.String> name()
        Returns:
        The name of the record.
      • records

        public com.pulumi.core.Output<java.util.Optional<java.util.List<java.lang.String>>> records()
        Returns:
        A string list of records. To specify a single record value longer than 255 characters such as a TXT record for DKIM, add `\"\"` inside the provider configuration string (e.g., `"first255characters\"\"morecharacters"`).
      • setIdentifier

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> setIdentifier()
        Returns:
        Unique identifier to differentiate records with routing policies from one another. Required if using `cidrRoutingPolicy`, `failoverRoutingPolicy`, `geolocationRoutingPolicy`,`geoproximityRoutingPolicy`, `latencyRoutingPolicy`, `multivalueAnswerRoutingPolicy`, or `weightedRoutingPolicy`.
      • ttl

        public com.pulumi.core.Output<java.util.Optional<java.lang.Integer>> ttl()
        Returns:
        The TTL of the record.
      • type

        public com.pulumi.core.Output<java.lang.String> type()
        Returns:
        The record type. Valid values are `A`, `AAAA`, `CAA`, `CNAME`, `DS`, `HTTPS`, `MX`, `NAPTR`, `NS`, `PTR`, `SOA`, `SPF`, `SRV`, `SSHFP`, `SVCB`, `TLSA`, and `TXT`.
      • weightedRoutingPolicies

        public com.pulumi.core.Output<java.util.Optional<java.util.List<RecordWeightedRoutingPolicy>>> weightedRoutingPolicies()
        Returns:
        A block indicating a weighted routing policy. Conflicts with any other routing policy. Documented below.
      • zoneId

        public com.pulumi.core.Output<java.lang.String> zoneId()
        Returns:
        The ID of the hosted zone to contain this record.
      • get

        public static Record get​(java.lang.String name,
                                 com.pulumi.core.Output<java.lang.String> id,
                                 @Nullable
                                 RecordState 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.