@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
280 lines • 9.4 kB
JavaScript
"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.getTrafficPolicyDocumentOutput = exports.getTrafficPolicyDocument = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Generates an Route53 traffic policy document in JSON format for use with resources that expect policy documents such as `aws.route53.TrafficPolicy`.
*
* ## Example Usage
*
* ### Basic Example
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const current = aws.getRegion({});
* const example = Promise.all([current, current]).then(([current, current1]) => aws.route53.getTrafficPolicyDocument({
* recordType: "A",
* startRule: "site_switch",
* endpoints: [
* {
* id: "my_elb",
* type: "elastic-load-balancer",
* value: `elb-111111.${current.region}.elb.amazonaws.com`,
* },
* {
* id: "site_down_banner",
* type: "s3-website",
* region: current1.region,
* value: "www.example.com",
* },
* ],
* rules: [{
* id: "site_switch",
* type: "failover",
* primary: {
* endpointReference: "my_elb",
* },
* secondary: {
* endpointReference: "site_down_banner",
* },
* }],
* }));
* const exampleTrafficPolicy = new aws.route53.TrafficPolicy("example", {
* name: "example",
* comment: "example comment",
* document: example.then(example => example.json),
* });
* ```
*
* ### Complex Example
*
* The following example showcases the use of nested rules within the traffic policy document and introduces the `geoproximity` rule type.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = aws.route53.getTrafficPolicyDocument({
* recordType: "A",
* startRule: "geoproximity_rule",
* endpoints: [
* {
* id: "na_endpoint_a",
* type: "elastic-load-balancer",
* value: "elb-111111.us-west-1.elb.amazonaws.com",
* },
* {
* id: "na_endpoint_b",
* type: "elastic-load-balancer",
* value: "elb-222222.us-west-1.elb.amazonaws.com",
* },
* {
* id: "eu_endpoint",
* type: "elastic-load-balancer",
* value: "elb-333333.eu-west-1.elb.amazonaws.com",
* },
* {
* id: "ap_endpoint",
* type: "elastic-load-balancer",
* value: "elb-444444.ap-northeast-2.elb.amazonaws.com",
* },
* ],
* rules: [
* {
* id: "na_rule",
* type: "failover",
* primary: {
* endpointReference: "na_endpoint_a",
* },
* secondary: {
* endpointReference: "na_endpoint_b",
* },
* },
* {
* id: "geoproximity_rule",
* type: "geoproximity",
* geoProximityLocations: [
* {
* region: "aws:route53:us-west-1",
* bias: "10",
* evaluateTargetHealth: true,
* ruleReference: "na_rule",
* },
* {
* region: "aws:route53:eu-west-1",
* bias: "10",
* evaluateTargetHealth: true,
* endpointReference: "eu_endpoint",
* },
* {
* region: "aws:route53:ap-northeast-2",
* bias: "0",
* evaluateTargetHealth: true,
* endpointReference: "ap_endpoint",
* },
* ],
* },
* ],
* });
* const exampleTrafficPolicy = new aws.route53.TrafficPolicy("example", {
* name: "example",
* comment: "example comment",
* document: example.then(example => example.json),
* });
* ```
*/
function getTrafficPolicyDocument(args, opts) {
args = args || {};
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts || {});
return pulumi.runtime.invoke("aws:route53/getTrafficPolicyDocument:getTrafficPolicyDocument", {
"endpoints": args.endpoints,
"recordType": args.recordType,
"rules": args.rules,
"startEndpoint": args.startEndpoint,
"startRule": args.startRule,
"version": args.version,
}, opts);
}
exports.getTrafficPolicyDocument = getTrafficPolicyDocument;
/**
* Generates an Route53 traffic policy document in JSON format for use with resources that expect policy documents such as `aws.route53.TrafficPolicy`.
*
* ## Example Usage
*
* ### Basic Example
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const current = aws.getRegion({});
* const example = Promise.all([current, current]).then(([current, current1]) => aws.route53.getTrafficPolicyDocument({
* recordType: "A",
* startRule: "site_switch",
* endpoints: [
* {
* id: "my_elb",
* type: "elastic-load-balancer",
* value: `elb-111111.${current.region}.elb.amazonaws.com`,
* },
* {
* id: "site_down_banner",
* type: "s3-website",
* region: current1.region,
* value: "www.example.com",
* },
* ],
* rules: [{
* id: "site_switch",
* type: "failover",
* primary: {
* endpointReference: "my_elb",
* },
* secondary: {
* endpointReference: "site_down_banner",
* },
* }],
* }));
* const exampleTrafficPolicy = new aws.route53.TrafficPolicy("example", {
* name: "example",
* comment: "example comment",
* document: example.then(example => example.json),
* });
* ```
*
* ### Complex Example
*
* The following example showcases the use of nested rules within the traffic policy document and introduces the `geoproximity` rule type.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = aws.route53.getTrafficPolicyDocument({
* recordType: "A",
* startRule: "geoproximity_rule",
* endpoints: [
* {
* id: "na_endpoint_a",
* type: "elastic-load-balancer",
* value: "elb-111111.us-west-1.elb.amazonaws.com",
* },
* {
* id: "na_endpoint_b",
* type: "elastic-load-balancer",
* value: "elb-222222.us-west-1.elb.amazonaws.com",
* },
* {
* id: "eu_endpoint",
* type: "elastic-load-balancer",
* value: "elb-333333.eu-west-1.elb.amazonaws.com",
* },
* {
* id: "ap_endpoint",
* type: "elastic-load-balancer",
* value: "elb-444444.ap-northeast-2.elb.amazonaws.com",
* },
* ],
* rules: [
* {
* id: "na_rule",
* type: "failover",
* primary: {
* endpointReference: "na_endpoint_a",
* },
* secondary: {
* endpointReference: "na_endpoint_b",
* },
* },
* {
* id: "geoproximity_rule",
* type: "geoproximity",
* geoProximityLocations: [
* {
* region: "aws:route53:us-west-1",
* bias: "10",
* evaluateTargetHealth: true,
* ruleReference: "na_rule",
* },
* {
* region: "aws:route53:eu-west-1",
* bias: "10",
* evaluateTargetHealth: true,
* endpointReference: "eu_endpoint",
* },
* {
* region: "aws:route53:ap-northeast-2",
* bias: "0",
* evaluateTargetHealth: true,
* endpointReference: "ap_endpoint",
* },
* ],
* },
* ],
* });
* const exampleTrafficPolicy = new aws.route53.TrafficPolicy("example", {
* name: "example",
* comment: "example comment",
* document: example.then(example => example.json),
* });
* ```
*/
function getTrafficPolicyDocumentOutput(args, opts) {
args = args || {};
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts || {});
return pulumi.runtime.invokeOutput("aws:route53/getTrafficPolicyDocument:getTrafficPolicyDocument", {
"endpoints": args.endpoints,
"recordType": args.recordType,
"rules": args.rules,
"startEndpoint": args.startEndpoint,
"startRule": args.startRule,
"version": args.version,
}, opts);
}
exports.getTrafficPolicyDocumentOutput = getTrafficPolicyDocumentOutput;
//# sourceMappingURL=getTrafficPolicyDocument.js.map