UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

301 lines • 10.4 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.Record = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides a Route53 record resource. * * ## Example Usage * * ### Simple routing policy * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const www = new aws.route53.Record("www", { * zoneId: primary.zoneId, * name: "www.example.com", * type: aws.route53.RecordType.A, * ttl: 300, * records: [lb.publicIp], * }); * ``` * * ### 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. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const www_dev = new aws.route53.Record("www-dev", { * zoneId: primary.zoneId, * name: "www", * type: aws.route53.RecordType.CNAME, * ttl: 5, * weightedRoutingPolicies: [{ * weight: 10, * }], * setIdentifier: "dev", * records: ["dev.example.com"], * }); * const www_live = new aws.route53.Record("www-live", { * zoneId: primary.zoneId, * name: "www", * type: aws.route53.RecordType.CNAME, * ttl: 5, * weightedRoutingPolicies: [{ * weight: 90, * }], * setIdentifier: "live", * records: ["live.example.com"], * }); * ``` * * ### Geoproximity routing policy * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const www = new aws.route53.Record("www", { * zoneId: primary.zoneId, * name: "www.example.com", * type: aws.route53.RecordType.CNAME, * ttl: 300, * geoproximityRoutingPolicy: { * coordinates: [{ * latitude: "49.22", * longitude: "-74.01", * }], * }, * setIdentifier: "dev", * records: ["dev.example.com"], * }); * ``` * * ### 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. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const main = new aws.elb.LoadBalancer("main", { * name: "foobar-elb", * availabilityZones: ["us-east-1c"], * listeners: [{ * instancePort: 80, * instanceProtocol: "http", * lbPort: 80, * lbProtocol: "http", * }], * }); * const www = new aws.route53.Record("www", { * zoneId: primary.zoneId, * name: "example.com", * type: aws.route53.RecordType.A, * aliases: [{ * name: main.dnsName, * zoneId: main.zoneId, * evaluateTargetHealth: true, * }], * }); * ``` * * ### Alias record for AWS Global Accelerator * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const main = new aws.globalaccelerator.Accelerator("main", { * name: "foobar-pulumi-accelerator", * enabled: true, * ipAddressType: "IPV4", * }); * const www = new aws.route53.Record("www", { * zoneId: primary.zoneId, * name: "example.com", * type: aws.route53.RecordType.A, * aliases: [{ * name: main.dnsName, * zoneId: main.hostedZoneId, * evaluateTargetHealth: false, * }], * }); * ``` * * ### 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`. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.route53.Zone("example", {name: "test.example.com"}); * const exampleRecord = new aws.route53.Record("example", { * allowOverwrite: true, * name: "test.example.com", * ttl: 172800, * type: aws.route53.RecordType.NS, * zoneId: example.zoneId, * records: [ * example.nameServers[0], * example.nameServers[1], * example.nameServers[2], * example.nameServers[3], * ], * }); * ``` * * ## Import * * ### Identity Schema * * #### Required * * * `zone_id` (String) Hosted zone ID for the record. * * * `name` (String) Name of the record. * * * `type` (String) Record type. * * #### Optional * * * `account_id` (String) AWS Account where this resource is managed. * * * `set_identifier` (String) Set identifier for the record. * * If the record also contains a set identifier, append it: * * terraform * * import { * * to = aws_route53_record.example * * id = "Z4KAPRWWNC7JR_dev.example.com_NS_dev" * * } * * If the record name is the empty string, it can be omitted: * * terraform * * import { * * to = aws_route53_record.example * * id = "Z4KAPRWWNC7JR__NS" * * } * * **Using `pulumi import` to import** Route53 Records using the ID of the record, record name, record type, and set identifier. For example: * * Using the ID of the record, which is the zone identifier, record name, and record type, separated by underscores (`_`): * * console * * % pulumi import aws_route53_record.example Z4KAPRWWNC7JR_dev_NS * * If the record also contains a set identifier, append it: * * console * * % pulumi import aws_route53_record.example Z4KAPRWWNC7JR_dev_NS_dev */ class Record extends pulumi.CustomResource { /** * Get an existing Record resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, state, opts) { return new Record(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of Record. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === Record.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["aliases"] = state?.aliases; resourceInputs["allowOverwrite"] = state?.allowOverwrite; resourceInputs["cidrRoutingPolicy"] = state?.cidrRoutingPolicy; resourceInputs["failoverRoutingPolicies"] = state?.failoverRoutingPolicies; resourceInputs["fqdn"] = state?.fqdn; resourceInputs["geolocationRoutingPolicies"] = state?.geolocationRoutingPolicies; resourceInputs["geoproximityRoutingPolicy"] = state?.geoproximityRoutingPolicy; resourceInputs["healthCheckId"] = state?.healthCheckId; resourceInputs["latencyRoutingPolicies"] = state?.latencyRoutingPolicies; resourceInputs["multivalueAnswerRoutingPolicy"] = state?.multivalueAnswerRoutingPolicy; resourceInputs["name"] = state?.name; resourceInputs["records"] = state?.records; resourceInputs["setIdentifier"] = state?.setIdentifier; resourceInputs["ttl"] = state?.ttl; resourceInputs["type"] = state?.type; resourceInputs["weightedRoutingPolicies"] = state?.weightedRoutingPolicies; resourceInputs["zoneId"] = state?.zoneId; } else { const args = argsOrState; if (args?.name === undefined && !opts.urn) { throw new Error("Missing required property 'name'"); } if (args?.type === undefined && !opts.urn) { throw new Error("Missing required property 'type'"); } if (args?.zoneId === undefined && !opts.urn) { throw new Error("Missing required property 'zoneId'"); } resourceInputs["aliases"] = args?.aliases; resourceInputs["allowOverwrite"] = args?.allowOverwrite; resourceInputs["cidrRoutingPolicy"] = args?.cidrRoutingPolicy; resourceInputs["failoverRoutingPolicies"] = args?.failoverRoutingPolicies; resourceInputs["geolocationRoutingPolicies"] = args?.geolocationRoutingPolicies; resourceInputs["geoproximityRoutingPolicy"] = args?.geoproximityRoutingPolicy; resourceInputs["healthCheckId"] = args?.healthCheckId; resourceInputs["latencyRoutingPolicies"] = args?.latencyRoutingPolicies; resourceInputs["multivalueAnswerRoutingPolicy"] = args?.multivalueAnswerRoutingPolicy; resourceInputs["name"] = args?.name; resourceInputs["records"] = args?.records; resourceInputs["setIdentifier"] = args?.setIdentifier; resourceInputs["ttl"] = args?.ttl; resourceInputs["type"] = args?.type; resourceInputs["weightedRoutingPolicies"] = args?.weightedRoutingPolicies; resourceInputs["zoneId"] = args?.zoneId; resourceInputs["fqdn"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Record.__pulumiType, name, resourceInputs, opts); } } exports.Record = Record; /** @internal */ Record.__pulumiType = 'aws:route53/record:Record'; //# sourceMappingURL=record.js.map