Class RecordSet
Manages a set of DNS records within Google Cloud DNS. For more information see the official documentation and API.
Note: The provider treats this resource as an authoritative record set. This means existing records (including the default records) for the given type will be overwritten when you create this resource in the provider. In addition, the Google Cloud DNS API requires NS records to be present at all times, so the provider will not actually remove NS records during destroy but will report that it did.
Example Usage
Adding an A record
using Pulumi;
using Gcp = Pulumi.Gcp;
class MyStack : Stack
{
public MyStack()
{
var prod = new Gcp.Dns.ManagedZone("prod", new Gcp.Dns.ManagedZoneArgs
{
DnsName = "prod.mydomain.com.",
});
var recordSet = new Gcp.Dns.RecordSet("recordSet", new Gcp.Dns.RecordSetArgs
{
ManagedZone = prod.Name,
Type = "A",
Ttl = 300,
Rrdatas =
{
"8.8.8.8",
},
});
}
}
Adding an MX record
using Pulumi;
using Gcp = Pulumi.Gcp;
class MyStack : Stack
{
public MyStack()
{
var prod = new Gcp.Dns.ManagedZone("prod", new Gcp.Dns.ManagedZoneArgs
{
DnsName = "prod.mydomain.com.",
});
var mx = new Gcp.Dns.RecordSet("mx", new Gcp.Dns.RecordSetArgs
{
ManagedZone = prod.Name,
Type = "MX",
Ttl = 3600,
Rrdatas =
{
"1 aspmx.l.google.com.",
"5 alt1.aspmx.l.google.com.",
"5 alt2.aspmx.l.google.com.",
"10 alt3.aspmx.l.google.com.",
"10 alt4.aspmx.l.google.com.",
},
});
}
}
Adding an SPF record
using Pulumi;
using Gcp = Pulumi.Gcp;
class MyStack : Stack
{
public MyStack()
{
var prod = new Gcp.Dns.ManagedZone("prod", new Gcp.Dns.ManagedZoneArgs
{
DnsName = "prod.mydomain.com.",
});
var spf = new Gcp.Dns.RecordSet("spf", new Gcp.Dns.RecordSetArgs
{
ManagedZone = prod.Name,
Type = "TXT",
Ttl = 300,
Rrdatas =
{
"\"v=spf1 ip4:111.111.111.111 include:backoff.email-example.com -all\"",
},
});
}
}
Adding a CNAME record
using Pulumi;
using Gcp = Pulumi.Gcp;
class MyStack : Stack
{
public MyStack()
{
var prod = new Gcp.Dns.ManagedZone("prod", new Gcp.Dns.ManagedZoneArgs
{
DnsName = "prod.mydomain.com.",
});
var cname = new Gcp.Dns.RecordSet("cname", new Gcp.Dns.RecordSetArgs
{
ManagedZone = prod.Name,
Type = "CNAME",
Ttl = 300,
Rrdatas =
{
"frontend.mydomain.com.",
},
});
}
}
Inherited Members
Namespace: Pulumi.Gcp.Dns
Assembly: Pulumi.Gcp.dll
Syntax
public class RecordSet : CustomResource
Constructors
View SourceRecordSet(String, RecordSetArgs, CustomResourceOptions)
Create a RecordSet resource with the given unique name, arguments, and options.
Declaration
public RecordSet(string name, RecordSetArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| RecordSetArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceManagedZone
The name of the zone in which this record set will reside.
Declaration
public Output<string> ManagedZone { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Name
The DNS name this record set will apply to.
Declaration
public Output<string> Name { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Project
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
Declaration
public Output<string> Project { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Rrdatas
The string data for the records in this record set
whose meaning depends on the DNS type. For TXT record, if the string data contains spaces, add surrounding \" if you don't want your string to get split on spaces. To specify a single record value longer than 255 characters such as a TXT record for DKIM, add \"\" inside the provider configuration string (e.g. "first255characters\"\"morecharacters").
Declaration
public Output<ImmutableArray<string>> Rrdatas { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<System.String>> |
Ttl
The time-to-live of this record set (seconds).
Declaration
public Output<int> Ttl { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Int32> |
Type
The DNS record set type.
Declaration
public Output<string> Type { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Methods
View SourceGet(String, Input<String>, RecordSetState, CustomResourceOptions)
Get an existing RecordSet resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static RecordSet Get(string name, Input<string> id, RecordSetState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| RecordSetState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| RecordSet |