@pulumiverse/scaleway
Version:
A Pulumi package for creating and managing Scaleway cloud resources.
317 lines • 11.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! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DomainRecord = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("./utilities"));
/**
* The `scaleway.domain.Record` resource allows you to create and manage DNS records for Scaleway domains.
*
* Refer to the Domains and DNS [product documentation](https://www.scaleway.com/en/docs/network/domains-and-dns/) and [API documentation](https://www.scaleway.com/en/developers/api/domains-and-dns/) for more information.
*
* ## Example Usage
*
* ### Create basic DNS records
*
* The following commands allow you to:
*
* - create an A record for the `www.domain.tld` domain, pointing to `1.2.3.4` and another one pointing to `1.2.3.5`
*
* - create an MX record with the `mx.online.net.` mail server and a priority of 10, and another one with the `mx-cache.online.net.` mail server and a priority of 20
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as scaleway from "@pulumiverse/scaleway";
*
* const www = new scaleway.domain.Record("www", {
* dnsZone: "domain.tld",
* name: "www",
* type: "A",
* data: "1.2.3.4",
* ttl: 3600,
* });
* const www2 = new scaleway.domain.Record("www2", {
* dnsZone: "domain.tld",
* name: "www",
* type: "A",
* data: "1.2.3.5",
* ttl: 3600,
* });
* const mx = new scaleway.domain.Record("mx", {
* dnsZone: "domain.tld",
* name: "",
* type: "MX",
* data: "mx.online.net.",
* ttl: 3600,
* priority: 10,
* });
* const mx2 = new scaleway.domain.Record("mx2", {
* dnsZone: "domain.tld",
* name: "",
* type: "MX",
* data: "mx-cache.online.net.",
* ttl: 3600,
* priority: 20,
* });
* ```
*
* ### Create dynamic records
*
* The following commands allow you to:
*
* - create a Geo IP record for `images.domain.tld` that points to different IPs based on the user's location: `1.2.3.5` for users in France (EU), and `4.3.2.1` for users in North America (NA)
*
* - create an HTTP service record for `app.domain.tld` that checks the health of specified IPs and responds based on their status.
*
* - create view-based records for `db.domain.tld` that resolve differently based on the client's subnet.
*
* - create a weighted record for `web.domain.tld` that directs traffic to different IPs based on their weights.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as scaleway from "@pulumiverse/scaleway";
*
* const geoIp = new scaleway.domain.Record("geo_ip", {
* dnsZone: "domain.tld",
* name: "images",
* type: "A",
* data: "1.2.3.4",
* ttl: 3600,
* geoIp: {
* matches: [
* {
* continents: ["EU"],
* countries: ["FR"],
* data: "1.2.3.5",
* },
* {
* continents: ["NA"],
* data: "4.3.2.1",
* },
* ],
* },
* });
* const httpService = new scaleway.domain.Record("http_service", {
* dnsZone: "domain.tld",
* name: "app",
* type: "A",
* data: "1.2.3.4",
* ttl: 3600,
* httpService: {
* ips: [
* "1.2.3.5",
* "1.2.3.6",
* ],
* mustContain: "up",
* url: "http://mywebsite.com/health",
* userAgent: "scw_service_up",
* strategy: "hashed",
* },
* });
* const view = new scaleway.domain.Record("view", {
* dnsZone: "domain.tld",
* name: "db",
* type: "A",
* data: "1.2.3.4",
* ttl: 3600,
* views: [
* {
* subnet: "100.0.0.0/16",
* data: "1.2.3.5",
* },
* {
* subnet: "100.1.0.0/16",
* data: "1.2.3.6",
* },
* ],
* });
* const weighted = new scaleway.domain.Record("weighted", {
* dnsZone: "domain.tld",
* name: "web",
* type: "A",
* data: "1.2.3.4",
* ttl: 3600,
* weighteds: [
* {
* ip: "1.2.3.5",
* weight: 1,
* },
* {
* ip: "1.2.3.6",
* weight: 2,
* },
* ],
* });
* ```
*
* ### Create an Instance and add records with the new Instance IP
*
* The following commands allow you to:
*
* - create a Scaleway Instance
* - assign The Instance's IP address to various DNS records for a specified DNS zone
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as scaleway from "@pulumiverse/scaleway";
*
* const config = new pulumi.Config();
* // Your project ID.
* const projectId = config.require("projectId");
* // The DNS Zone used for testing records.
* const dnsZone = config.require("dnsZone");
* const publicIp = new scaleway.instance.Ip("public_ip", {projectId: projectId});
* const web = new scaleway.instance.Server("web", {
* projectId: projectId,
* type: "DEV1-S",
* image: "ubuntu_jammy",
* tags: [
* "front",
* "web",
* ],
* ipId: publicIp.id,
* rootVolume: {
* sizeInGb: 20,
* },
* });
* const webA = new scaleway.domain.Record("web_A", {
* dnsZone: dnsZone,
* name: "web",
* type: "A",
* data: web.publicIp,
* ttl: 3600,
* });
* const webCname = new scaleway.domain.Record("web_cname", {
* dnsZone: dnsZone,
* name: "www",
* type: "CNAME",
* data: `web.${dnsZone}.`,
* ttl: 3600,
* });
* const webAlias = new scaleway.domain.Record("web_alias", {
* dnsZone: dnsZone,
* name: "",
* type: "ALIAS",
* data: `web.${dnsZone}.`,
* ttl: 3600,
* });
* ```
*
* ## Multiple records
*
* Some record types can have multiple data with the same name (e.g., `A`, `AAAA`, `MX`, `NS`, etc.). You can duplicate a `scaleway.domain.Record` resource with the same `name`, and the records will be added.
*
* Note however, that some records (e.g., CNAME, multiple dynamic records of different types) must be unique.
*
* ## Import
*
* This section explains how to import a record using the `{dns_zone}/{id}` format.
*
* ```sh
* $ pulumi import scaleway:index/domainRecord:DomainRecord www subdomain.domain.tld/11111111-1111-1111-1111-111111111111
* ```
*
* @deprecated scaleway.index/domainrecord.DomainRecord has been deprecated in favor of scaleway.domain/record.Record
*/
class DomainRecord extends pulumi.CustomResource {
/**
* Get an existing DomainRecord 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) {
pulumi.log.warn("DomainRecord is deprecated: scaleway.index/domainrecord.DomainRecord has been deprecated in favor of scaleway.domain/record.Record");
return new DomainRecord(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'scaleway:index/domainRecord:DomainRecord';
/**
* Returns true if the given object is an instance of DomainRecord. 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'] === DomainRecord.__pulumiType;
}
/** @deprecated scaleway.index/domainrecord.DomainRecord has been deprecated in favor of scaleway.domain/record.Record */
constructor(name, argsOrState, opts) {
pulumi.log.warn("DomainRecord is deprecated: scaleway.index/domainrecord.DomainRecord has been deprecated in favor of scaleway.domain/record.Record");
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["data"] = state?.data;
resourceInputs["dnsZone"] = state?.dnsZone;
resourceInputs["fqdn"] = state?.fqdn;
resourceInputs["geoIp"] = state?.geoIp;
resourceInputs["httpService"] = state?.httpService;
resourceInputs["name"] = state?.name;
resourceInputs["priority"] = state?.priority;
resourceInputs["projectId"] = state?.projectId;
resourceInputs["rootZone"] = state?.rootZone;
resourceInputs["ttl"] = state?.ttl;
resourceInputs["type"] = state?.type;
resourceInputs["views"] = state?.views;
resourceInputs["weighteds"] = state?.weighteds;
}
else {
const args = argsOrState;
if (args?.data === undefined && !opts.urn) {
throw new Error("Missing required property 'data'");
}
if (args?.dnsZone === undefined && !opts.urn) {
throw new Error("Missing required property 'dnsZone'");
}
if (args?.type === undefined && !opts.urn) {
throw new Error("Missing required property 'type'");
}
resourceInputs["data"] = args?.data;
resourceInputs["dnsZone"] = args?.dnsZone;
resourceInputs["geoIp"] = args?.geoIp;
resourceInputs["httpService"] = args?.httpService;
resourceInputs["name"] = args?.name;
resourceInputs["priority"] = args?.priority;
resourceInputs["projectId"] = args?.projectId;
resourceInputs["ttl"] = args?.ttl;
resourceInputs["type"] = args?.type;
resourceInputs["views"] = args?.views;
resourceInputs["weighteds"] = args?.weighteds;
resourceInputs["fqdn"] = undefined /*out*/;
resourceInputs["rootZone"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(DomainRecord.__pulumiType, name, resourceInputs, opts);
}
}
exports.DomainRecord = DomainRecord;
//# sourceMappingURL=domainRecord.js.map