import * as pulumi from "@pulumi/pulumi"; import * as inputs from "./types/input"; import * as outputs from "./types/output"; /** * The `scaleway.DomainRecord` 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 "@ediri/scaleway"; * * const www = new scaleway.DomainRecord("www", { * data: "1.2.3.4", * dnsZone: "domain.tld", * ttl: 3600, * type: "A", * }); * const www2 = new scaleway.DomainRecord("www2", { * data: "1.2.3.5", * dnsZone: "domain.tld", * ttl: 3600, * type: "A", * }); * const mx = new scaleway.DomainRecord("mx", { * data: "mx.online.net.", * dnsZone: "domain.tld", * priority: 10, * ttl: 3600, * type: "MX", * }); * const mx2 = new scaleway.DomainRecord("mx2", { * data: "mx-cache.online.net.", * dnsZone: "domain.tld", * priority: 20, * ttl: 3600, * type: "MX", * }); * ``` * * ### 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 "@ediri/scaleway"; * * const geoIp = new scaleway.DomainRecord("geoIp", { * data: "1.2.3.4", * dnsZone: "domain.tld", * geoIp: { * matches: [ * { * continents: ["EU"], * countries: ["FR"], * data: "1.2.3.5", * }, * { * continents: ["NA"], * data: "4.3.2.1", * }, * ], * }, * ttl: 3600, * type: "A", * }); * const httpService = new scaleway.DomainRecord("httpService", { * data: "1.2.3.4", * dnsZone: "domain.tld", * httpService: { * ips: [ * "1.2.3.5", * "1.2.3.6", * ], * mustContain: "up", * strategy: "hashed", * url: "http://mywebsite.com/health", * userAgent: "scw_service_up", * }, * ttl: 3600, * type: "A", * }); * const view = new scaleway.DomainRecord("view", { * data: "1.2.3.4", * dnsZone: "domain.tld", * ttl: 3600, * type: "A", * views: [ * { * data: "1.2.3.5", * subnet: "100.0.0.0/16", * }, * { * data: "1.2.3.6", * subnet: "100.1.0.0/16", * }, * ], * }); * const weighted = new scaleway.DomainRecord("weighted", { * data: "1.2.3.4", * dnsZone: "domain.tld", * ttl: 3600, * type: "A", * 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 "@ediri/scaleway"; * * const config = new pulumi.Config(); * const projectId = config.require("projectId"); * const dnsZone = config.require("dnsZone"); * const publicIp = new scaleway.InstanceIp("publicIp", {projectId: projectId}); * const web = new scaleway.InstanceServer("web", { * projectId: projectId, * type: "DEV1-S", * image: "ubuntu_jammy", * tags: [ * "front", * "web", * ], * ipId: publicIp.id, * rootVolume: { * sizeInGb: 20, * }, * }); * const webA = new scaleway.DomainRecord("webA", { * dnsZone: dnsZone, * type: "A", * data: web.publicIp, * ttl: 3600, * }); * const webCname = new scaleway.DomainRecord("webCname", { * dnsZone: dnsZone, * type: "CNAME", * data: `web.${dnsZone}.`, * ttl: 3600, * }); * const webAlias = new scaleway.DomainRecord("webAlias", { * dnsZone: dnsZone, * 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.DomainRecord` 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 * ``` */ 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, 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; /** * The DNS zone of the domain. If the domain has no DNS zone, one will be automatically created. */ readonly dnsZone: pulumi.Output; /** * The FQDN of the record. */ readonly fqdn: pulumi.Output; /** * Return record based on client localisation */ readonly geoIp: pulumi.Output; /** * Return record based on client localisation */ readonly httpService: pulumi.Output; /** * 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; /** * The name of the record (can be an empty string for a root record). */ readonly name: pulumi.Output; /** * The priority of the record (mostly used with an `MX` record). */ readonly priority: pulumi.Output; /** * The projectId you want to attach the resource to */ readonly projectId: pulumi.Output; /** * Does the DNS zone is the root zone or not */ readonly rootZone: pulumi.Output; /** * Time To Live of the record in seconds. */ readonly ttl: pulumi.Output; /** * The type of the record (`A`, `AAAA`, `MX`, `CNAME`, `DNAME`, `ALIAS`, `NS`, `PTR`, `SRV`, `TXT`, `TLSA`, or `CAA`). */ readonly type: pulumi.Output; /** * Return record based on client subnet */ readonly views: pulumi.Output; /** * Return record based on weight */ readonly weighteds: pulumi.Output; /** * 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. */ 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; /** * The DNS zone of the domain. If the domain has no DNS zone, one will be automatically created. */ dnsZone?: pulumi.Input; /** * The FQDN of the record. */ fqdn?: pulumi.Input; /** * Return record based on client localisation */ geoIp?: pulumi.Input; /** * Return record based on client localisation */ httpService?: pulumi.Input; /** * 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; /** * The name of the record (can be an empty string for a root record). */ name?: pulumi.Input; /** * The priority of the record (mostly used with an `MX` record). */ priority?: pulumi.Input; /** * The projectId you want to attach the resource to */ projectId?: pulumi.Input; /** * Does the DNS zone is the root zone or not */ rootZone?: pulumi.Input; /** * Time To Live of the record in seconds. */ ttl?: pulumi.Input; /** * The type of the record (`A`, `AAAA`, `MX`, `CNAME`, `DNAME`, `ALIAS`, `NS`, `PTR`, `SRV`, `TXT`, `TLSA`, or `CAA`). */ type?: pulumi.Input; /** * Return record based on client subnet */ views?: pulumi.Input[]>; /** * Return record based on weight */ weighteds?: pulumi.Input[]>; } /** * 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; /** * The DNS zone of the domain. If the domain has no DNS zone, one will be automatically created. */ dnsZone: pulumi.Input; /** * Return record based on client localisation */ geoIp?: pulumi.Input; /** * Return record based on client localisation */ httpService?: pulumi.Input; /** * 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; /** * The name of the record (can be an empty string for a root record). */ name?: pulumi.Input; /** * The priority of the record (mostly used with an `MX` record). */ priority?: pulumi.Input; /** * The projectId you want to attach the resource to */ projectId?: pulumi.Input; /** * Time To Live of the record in seconds. */ ttl?: pulumi.Input; /** * The type of the record (`A`, `AAAA`, `MX`, `CNAME`, `DNAME`, `ALIAS`, `NS`, `PTR`, `SRV`, `TXT`, `TLSA`, or `CAA`). */ type: pulumi.Input; /** * Return record based on client subnet */ views?: pulumi.Input[]>; /** * Return record based on weight */ weighteds?: pulumi.Input[]>; }