@pulumiverse/scaleway
Version:
A Pulumi package for creating and managing Scaleway cloud resources.
298 lines • 11.1 kB
JavaScript
;
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.DomainRecord = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = 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 folllowing 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 folllowing 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.
*
* bash
*
* ```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, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* 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 ? state.data : undefined;
resourceInputs["dnsZone"] = state ? state.dnsZone : undefined;
resourceInputs["fqdn"] = state ? state.fqdn : undefined;
resourceInputs["geoIp"] = state ? state.geoIp : undefined;
resourceInputs["httpService"] = state ? state.httpService : undefined;
resourceInputs["keepEmptyZone"] = state ? state.keepEmptyZone : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["priority"] = state ? state.priority : undefined;
resourceInputs["projectId"] = state ? state.projectId : undefined;
resourceInputs["rootZone"] = state ? state.rootZone : undefined;
resourceInputs["ttl"] = state ? state.ttl : undefined;
resourceInputs["type"] = state ? state.type : undefined;
resourceInputs["views"] = state ? state.views : undefined;
resourceInputs["weighteds"] = state ? state.weighteds : undefined;
}
else {
const args = argsOrState;
if ((!args || args.data === undefined) && !opts.urn) {
throw new Error("Missing required property 'data'");
}
if ((!args || args.dnsZone === undefined) && !opts.urn) {
throw new Error("Missing required property 'dnsZone'");
}
if ((!args || args.type === undefined) && !opts.urn) {
throw new Error("Missing required property 'type'");
}
resourceInputs["data"] = args ? args.data : undefined;
resourceInputs["dnsZone"] = args ? args.dnsZone : undefined;
resourceInputs["geoIp"] = args ? args.geoIp : undefined;
resourceInputs["httpService"] = args ? args.httpService : undefined;
resourceInputs["keepEmptyZone"] = args ? args.keepEmptyZone : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["priority"] = args ? args.priority : undefined;
resourceInputs["projectId"] = args ? args.projectId : undefined;
resourceInputs["ttl"] = args ? args.ttl : undefined;
resourceInputs["type"] = args ? args.type : undefined;
resourceInputs["views"] = args ? args.views : undefined;
resourceInputs["weighteds"] = args ? args.weighteds : undefined;
resourceInputs["fqdn"] = undefined /*out*/;
resourceInputs["rootZone"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(DomainRecord.__pulumiType, name, resourceInputs, opts);
}
}
exports.DomainRecord = DomainRecord;
/** @internal */
DomainRecord.__pulumiType = 'scaleway:index/domainRecord:DomainRecord';
//# sourceMappingURL=domainRecord.js.map