@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
264 lines • 10.5 kB
JavaScript
;
// *** 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
*
* 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 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 (`_`):
*
* ```sh
* $ pulumi import aws:route53/record:Record myrecord Z4KAPRWWNC7JR_dev_NS
* ```
* If the record also contains a set identifier, append it:
*
* ```sh
* $ pulumi import aws:route53/record:Record myrecord 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, Object.assign(Object.assign({}, 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 ? state.aliases : undefined;
resourceInputs["allowOverwrite"] = state ? state.allowOverwrite : undefined;
resourceInputs["cidrRoutingPolicy"] = state ? state.cidrRoutingPolicy : undefined;
resourceInputs["failoverRoutingPolicies"] = state ? state.failoverRoutingPolicies : undefined;
resourceInputs["fqdn"] = state ? state.fqdn : undefined;
resourceInputs["geolocationRoutingPolicies"] = state ? state.geolocationRoutingPolicies : undefined;
resourceInputs["geoproximityRoutingPolicy"] = state ? state.geoproximityRoutingPolicy : undefined;
resourceInputs["healthCheckId"] = state ? state.healthCheckId : undefined;
resourceInputs["latencyRoutingPolicies"] = state ? state.latencyRoutingPolicies : undefined;
resourceInputs["multivalueAnswerRoutingPolicy"] = state ? state.multivalueAnswerRoutingPolicy : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["records"] = state ? state.records : undefined;
resourceInputs["setIdentifier"] = state ? state.setIdentifier : undefined;
resourceInputs["ttl"] = state ? state.ttl : undefined;
resourceInputs["type"] = state ? state.type : undefined;
resourceInputs["weightedRoutingPolicies"] = state ? state.weightedRoutingPolicies : undefined;
resourceInputs["zoneId"] = state ? state.zoneId : undefined;
}
else {
const args = argsOrState;
if ((!args || args.name === undefined) && !opts.urn) {
throw new Error("Missing required property 'name'");
}
if ((!args || args.type === undefined) && !opts.urn) {
throw new Error("Missing required property 'type'");
}
if ((!args || args.zoneId === undefined) && !opts.urn) {
throw new Error("Missing required property 'zoneId'");
}
resourceInputs["aliases"] = args ? args.aliases : undefined;
resourceInputs["allowOverwrite"] = args ? args.allowOverwrite : undefined;
resourceInputs["cidrRoutingPolicy"] = args ? args.cidrRoutingPolicy : undefined;
resourceInputs["failoverRoutingPolicies"] = args ? args.failoverRoutingPolicies : undefined;
resourceInputs["geolocationRoutingPolicies"] = args ? args.geolocationRoutingPolicies : undefined;
resourceInputs["geoproximityRoutingPolicy"] = args ? args.geoproximityRoutingPolicy : undefined;
resourceInputs["healthCheckId"] = args ? args.healthCheckId : undefined;
resourceInputs["latencyRoutingPolicies"] = args ? args.latencyRoutingPolicies : undefined;
resourceInputs["multivalueAnswerRoutingPolicy"] = args ? args.multivalueAnswerRoutingPolicy : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["records"] = args ? args.records : undefined;
resourceInputs["setIdentifier"] = args ? args.setIdentifier : undefined;
resourceInputs["ttl"] = args ? args.ttl : undefined;
resourceInputs["type"] = args ? args.type : undefined;
resourceInputs["weightedRoutingPolicies"] = args ? args.weightedRoutingPolicies : undefined;
resourceInputs["zoneId"] = args ? args.zoneId : undefined;
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