@pulumiverse/scaleway
Version:
A Pulumi package for creating and managing Scaleway cloud resources.
411 lines (410 loc) • 13.7 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "./types/input";
import * as outputs from "./types/output";
/**
* 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
*/
export declare 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: string, id: pulumi.Input<pulumi.ID>, state?: DomainRecordState, opts?: pulumi.CustomResourceOptions): 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: any): obj is DomainRecord;
/**
* The content of the record (an IPv4 for an `A` record, a string for a `TXT` record, etc.).
*/
readonly data: pulumi.Output<string>;
/**
* The DNS zone of the domain. If the domain has no DNS zone, one will be automatically created.
*/
readonly dnsZone: pulumi.Output<string>;
/**
* The FQDN of the record.
*/
readonly fqdn: pulumi.Output<string>;
/**
* Return record based on client localisation
*/
readonly geoIp: pulumi.Output<outputs.DomainRecordGeoIp | undefined>;
/**
* Return record based on client localisation
*/
readonly httpService: pulumi.Output<outputs.DomainRecordHttpService | undefined>;
/**
* When destroying a resource, if only NS records remain and this is set to `false`, the zone will be deleted. Note that each zone not deleted will [be billed](https://www.scaleway.com/en/dns/).
*/
readonly keepEmptyZone: pulumi.Output<boolean | undefined>;
/**
* The name of the record (can be an empty string for a root record).
*/
readonly name: pulumi.Output<string>;
/**
* The priority of the record (mostly used with an `MX` record).
*/
readonly priority: pulumi.Output<number>;
/**
* The projectId you want to attach the resource to
*/
readonly projectId: pulumi.Output<string>;
/**
* Does the DNS zone is the root zone or not
*/
readonly rootZone: pulumi.Output<boolean>;
/**
* Time To Live of the record in seconds.
*/
readonly ttl: pulumi.Output<number | undefined>;
/**
* The type of the record (`A`, `AAAA`, `MX`, `CNAME`, `DNAME`, `ALIAS`, `NS`, `PTR`, `SRV`, `TXT`, `TLSA`, or `CAA`).
*/
readonly type: pulumi.Output<string>;
/**
* Return record based on client subnet
*/
readonly views: pulumi.Output<outputs.DomainRecordView[] | undefined>;
/**
* Return record based on weight
*/
readonly weighteds: pulumi.Output<outputs.DomainRecordWeighted[] | undefined>;
/**
* Create a DomainRecord resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
/** @deprecated scaleway.index/domainrecord.DomainRecord has been deprecated in favor of scaleway.domain/record.Record */
constructor(name: string, args: DomainRecordArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering DomainRecord resources.
*/
export interface DomainRecordState {
/**
* The content of the record (an IPv4 for an `A` record, a string for a `TXT` record, etc.).
*/
data?: pulumi.Input<string>;
/**
* The DNS zone of the domain. If the domain has no DNS zone, one will be automatically created.
*/
dnsZone?: pulumi.Input<string>;
/**
* The FQDN of the record.
*/
fqdn?: pulumi.Input<string>;
/**
* Return record based on client localisation
*/
geoIp?: pulumi.Input<inputs.DomainRecordGeoIp>;
/**
* Return record based on client localisation
*/
httpService?: pulumi.Input<inputs.DomainRecordHttpService>;
/**
* When destroying a resource, if only NS records remain and this is set to `false`, the zone will be deleted. Note that each zone not deleted will [be billed](https://www.scaleway.com/en/dns/).
*/
keepEmptyZone?: pulumi.Input<boolean>;
/**
* The name of the record (can be an empty string for a root record).
*/
name?: pulumi.Input<string>;
/**
* The priority of the record (mostly used with an `MX` record).
*/
priority?: pulumi.Input<number>;
/**
* The projectId you want to attach the resource to
*/
projectId?: pulumi.Input<string>;
/**
* Does the DNS zone is the root zone or not
*/
rootZone?: pulumi.Input<boolean>;
/**
* Time To Live of the record in seconds.
*/
ttl?: pulumi.Input<number>;
/**
* The type of the record (`A`, `AAAA`, `MX`, `CNAME`, `DNAME`, `ALIAS`, `NS`, `PTR`, `SRV`, `TXT`, `TLSA`, or `CAA`).
*/
type?: pulumi.Input<string>;
/**
* Return record based on client subnet
*/
views?: pulumi.Input<pulumi.Input<inputs.DomainRecordView>[]>;
/**
* Return record based on weight
*/
weighteds?: pulumi.Input<pulumi.Input<inputs.DomainRecordWeighted>[]>;
}
/**
* The set of arguments for constructing a DomainRecord resource.
*/
export interface DomainRecordArgs {
/**
* The content of the record (an IPv4 for an `A` record, a string for a `TXT` record, etc.).
*/
data: pulumi.Input<string>;
/**
* The DNS zone of the domain. If the domain has no DNS zone, one will be automatically created.
*/
dnsZone: pulumi.Input<string>;
/**
* Return record based on client localisation
*/
geoIp?: pulumi.Input<inputs.DomainRecordGeoIp>;
/**
* Return record based on client localisation
*/
httpService?: pulumi.Input<inputs.DomainRecordHttpService>;
/**
* When destroying a resource, if only NS records remain and this is set to `false`, the zone will be deleted. Note that each zone not deleted will [be billed](https://www.scaleway.com/en/dns/).
*/
keepEmptyZone?: pulumi.Input<boolean>;
/**
* The name of the record (can be an empty string for a root record).
*/
name?: pulumi.Input<string>;
/**
* The priority of the record (mostly used with an `MX` record).
*/
priority?: pulumi.Input<number>;
/**
* The projectId you want to attach the resource to
*/
projectId?: pulumi.Input<string>;
/**
* Time To Live of the record in seconds.
*/
ttl?: pulumi.Input<number>;
/**
* The type of the record (`A`, `AAAA`, `MX`, `CNAME`, `DNAME`, `ALIAS`, `NS`, `PTR`, `SRV`, `TXT`, `TLSA`, or `CAA`).
*/
type: pulumi.Input<string>;
/**
* Return record based on client subnet
*/
views?: pulumi.Input<pulumi.Input<inputs.DomainRecordView>[]>;
/**
* Return record based on weight
*/
weighteds?: pulumi.Input<pulumi.Input<inputs.DomainRecordWeighted>[]>;
}