Hetzner Cloud

v1.10.1 published on Wednesday, Aug 3, 2022 by Pulumi

Rdns

Provides a Hetzner Cloud Reverse DNS Entry to create, modify and reset reverse dns entries for Hetzner Cloud Servers, Floating IPs or Load Balancers.

Example Usage

For servers

using Pulumi;
using HCloud = Pulumi.HCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var node1 = new HCloud.Server("node1", new HCloud.ServerArgs
        {
            Image = "debian-9",
            ServerType = "cx11",
        });
        var master = new HCloud.Rdns("master", new HCloud.RdnsArgs
        {
            ServerId = node1.Id,
            IpAddress = node1.Ipv4Address,
            DnsPtr = "example.com",
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-hcloud/sdk/go/hcloud"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		node1, err := hcloud.NewServer(ctx, "node1", &hcloud.ServerArgs{
			Image:      pulumi.String("debian-9"),
			ServerType: pulumi.String("cx11"),
		})
		if err != nil {
			return err
		}
		_, err = hcloud.NewRdns(ctx, "master", &hcloud.RdnsArgs{
			ServerId:  node1.ID(),
			IpAddress: node1.Ipv4Address,
			DnsPtr:    pulumi.String("example.com"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var node1 = new Server("node1", ServerArgs.builder()        
            .image("debian-9")
            .serverType("cx11")
            .build());

        var master = new Rdns("master", RdnsArgs.builder()        
            .serverId(node1.id())
            .ipAddress(node1.ipv4Address())
            .dnsPtr("example.com")
            .build());

    }
}
import pulumi
import pulumi_hcloud as hcloud

node1 = hcloud.Server("node1",
    image="debian-9",
    server_type="cx11")
master = hcloud.Rdns("master",
    server_id=node1.id,
    ip_address=node1.ipv4_address,
    dns_ptr="example.com")
import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";

const node1 = new hcloud.Server("node1", {
    image: "debian-9",
    serverType: "cx11",
});
const master = new hcloud.Rdns("master", {
    serverId: node1.id,
    ipAddress: node1.ipv4Address,
    dnsPtr: "example.com",
});
resources:
  node1:
    type: hcloud:Server
    properties:
      image: debian-9
      serverType: cx11
  master:
    type: hcloud:Rdns
    properties:
      serverId: ${node1.id}
      ipAddress: ${node1.ipv4Address}
      dnsPtr: example.com

For Floating IPs

using Pulumi;
using HCloud = Pulumi.HCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var floating1 = new HCloud.FloatingIp("floating1", new HCloud.FloatingIpArgs
        {
            HomeLocation = "nbg1",
            Type = "ipv4",
        });
        var floatingMaster = new HCloud.Rdns("floatingMaster", new HCloud.RdnsArgs
        {
            DnsPtr = "example.com",
            FloatingIpId = floating1.Id,
            IpAddress = floating1.IpAddress,
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-hcloud/sdk/go/hcloud"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		floating1, err := hcloud.NewFloatingIp(ctx, "floating1", &hcloud.FloatingIpArgs{
			HomeLocation: pulumi.String("nbg1"),
			Type:         pulumi.String("ipv4"),
		})
		if err != nil {
			return err
		}
		_, err = hcloud.NewRdns(ctx, "floatingMaster", &hcloud.RdnsArgs{
			DnsPtr:       pulumi.String("example.com"),
			FloatingIpId: floating1.ID(),
			IpAddress:    floating1.IpAddress,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var floating1 = new FloatingIp("floating1", FloatingIpArgs.builder()        
            .homeLocation("nbg1")
            .type("ipv4")
            .build());

        var floatingMaster = new Rdns("floatingMaster", RdnsArgs.builder()        
            .dnsPtr("example.com")
            .floatingIpId(floating1.id())
            .ipAddress(floating1.ipAddress())
            .build());

    }
}
import pulumi
import pulumi_hcloud as hcloud

floating1 = hcloud.FloatingIp("floating1",
    home_location="nbg1",
    type="ipv4")
floating_master = hcloud.Rdns("floatingMaster",
    dns_ptr="example.com",
    floating_ip_id=floating1.id,
    ip_address=floating1.ip_address)
import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";

const floating1 = new hcloud.FloatingIp("floating1", {
    homeLocation: "nbg1",
    type: "ipv4",
});
const floatingMaster = new hcloud.Rdns("floating_master", {
    dnsPtr: "example.com",
    floatingIpId: floating1.id.apply(id => Number.parseFloat(id)),
    ipAddress: floating1.ipAddress,
});
resources:
  floating1:
    type: hcloud:FloatingIp
    properties:
      homeLocation: nbg1
      type: ipv4
  floatingMaster:
    type: hcloud:Rdns
    properties:
      dnsPtr: example.com
      floatingIpId: ${floating1.id}
      ipAddress: ${floating1.ipAddress}

For Load Balancers

using Pulumi;
using HCloud = Pulumi.HCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var loadBalancer1 = new HCloud.LoadBalancer("loadBalancer1", new HCloud.LoadBalancerArgs
        {
            LoadBalancerType = "lb11",
            Location = "fsn1",
        });
        var loadBalancerMaster = new HCloud.Rdns("loadBalancerMaster", new HCloud.RdnsArgs
        {
            DnsPtr = "example.com",
            IpAddress = loadBalancer1.Ipv4,
            LoadBalancerId = loadBalancer1.Id,
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-hcloud/sdk/go/hcloud"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		loadBalancer1, err := hcloud.NewLoadBalancer(ctx, "loadBalancer1", &hcloud.LoadBalancerArgs{
			LoadBalancerType: pulumi.String("lb11"),
			Location:         pulumi.String("fsn1"),
		})
		if err != nil {
			return err
		}
		_, err = hcloud.NewRdns(ctx, "loadBalancerMaster", &hcloud.RdnsArgs{
			DnsPtr:         pulumi.String("example.com"),
			IpAddress:      loadBalancer1.Ipv4,
			LoadBalancerId: loadBalancer1.ID(),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var loadBalancer1 = new LoadBalancer("loadBalancer1", LoadBalancerArgs.builder()        
            .loadBalancerType("lb11")
            .location("fsn1")
            .build());

        var loadBalancerMaster = new Rdns("loadBalancerMaster", RdnsArgs.builder()        
            .dnsPtr("example.com")
            .ipAddress(loadBalancer1.ipv4())
            .loadBalancerId(loadBalancer1.id())
            .build());

    }
}
import pulumi
import pulumi_hcloud as hcloud

load_balancer1 = hcloud.LoadBalancer("loadBalancer1",
    load_balancer_type="lb11",
    location="fsn1")
load_balancer_master = hcloud.Rdns("loadBalancerMaster",
    dns_ptr="example.com",
    ip_address=load_balancer1.ipv4,
    load_balancer_id=load_balancer1.id)
import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";

const loadBalancer1 = new hcloud.LoadBalancer("load_balancer1", {
    loadBalancerType: "lb11",
    location: "fsn1",
});
const loadBalancerMaster = new hcloud.Rdns("load_balancer_master", {
    dnsPtr: "example.com",
    ipAddress: loadBalancer1.ipv4,
    loadBalancerId: loadBalancer1.id.apply(id => Number.parseFloat(id)),
});
resources:
  loadBalancer1:
    type: hcloud:LoadBalancer
    properties:
      loadBalancerType: lb11
      location: fsn1
  loadBalancerMaster:
    type: hcloud:Rdns
    properties:
      dnsPtr: example.com
      ipAddress: ${loadBalancer1.ipv4}
      loadBalancerId: ${loadBalancer1.id}

Create Rdns Resource

new Rdns(name: string, args: RdnsArgs, opts?: CustomResourceOptions);
@overload
def Rdns(resource_name: str,
         opts: Optional[ResourceOptions] = None,
         dns_ptr: Optional[str] = None,
         floating_ip_id: Optional[int] = None,
         ip_address: Optional[str] = None,
         load_balancer_id: Optional[int] = None,
         server_id: Optional[int] = None)
@overload
def Rdns(resource_name: str,
         args: RdnsArgs,
         opts: Optional[ResourceOptions] = None)
func NewRdns(ctx *Context, name string, args RdnsArgs, opts ...ResourceOption) (*Rdns, error)
public Rdns(string name, RdnsArgs args, CustomResourceOptions? opts = null)
public Rdns(String name, RdnsArgs args)
public Rdns(String name, RdnsArgs args, CustomResourceOptions options)
type: hcloud:Rdns
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args RdnsArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args RdnsArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args RdnsArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args RdnsArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args RdnsArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Rdns Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The Rdns resource accepts the following input properties:

DnsPtr string

The DNS address the ip_address should resolve to.

IpAddress string

The IP address that should point to dns_ptr.

FloatingIpId int

The Floating IP the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

LoadBalancerId int

The Load Balancer the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

ServerId int

The server the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

DnsPtr string

The DNS address the ip_address should resolve to.

IpAddress string

The IP address that should point to dns_ptr.

FloatingIpId int

The Floating IP the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

LoadBalancerId int

The Load Balancer the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

ServerId int

The server the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

dnsPtr String

The DNS address the ip_address should resolve to.

ipAddress String

The IP address that should point to dns_ptr.

floatingIpId Integer

The Floating IP the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

loadBalancerId Integer

The Load Balancer the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

serverId Integer

The server the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

dnsPtr string

The DNS address the ip_address should resolve to.

ipAddress string

The IP address that should point to dns_ptr.

floatingIpId number

The Floating IP the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

loadBalancerId number

The Load Balancer the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

serverId number

The server the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

dns_ptr str

The DNS address the ip_address should resolve to.

ip_address str

The IP address that should point to dns_ptr.

floating_ip_id int

The Floating IP the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

load_balancer_id int

The Load Balancer the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

server_id int

The server the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

dnsPtr String

The DNS address the ip_address should resolve to.

ipAddress String

The IP address that should point to dns_ptr.

floatingIpId Number

The Floating IP the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

loadBalancerId Number

The Load Balancer the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

serverId Number

The server the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

Outputs

All input properties are implicitly available as output properties. Additionally, the Rdns resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

Id string

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

id string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up Existing Rdns Resource

Get an existing Rdns resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: RdnsState, opts?: CustomResourceOptions): Rdns
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        dns_ptr: Optional[str] = None,
        floating_ip_id: Optional[int] = None,
        ip_address: Optional[str] = None,
        load_balancer_id: Optional[int] = None,
        server_id: Optional[int] = None) -> Rdns
func GetRdns(ctx *Context, name string, id IDInput, state *RdnsState, opts ...ResourceOption) (*Rdns, error)
public static Rdns Get(string name, Input<string> id, RdnsState? state, CustomResourceOptions? opts = null)
public static Rdns get(String name, Output<String> id, RdnsState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
DnsPtr string

The DNS address the ip_address should resolve to.

FloatingIpId int

The Floating IP the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

IpAddress string

The IP address that should point to dns_ptr.

LoadBalancerId int

The Load Balancer the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

ServerId int

The server the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

DnsPtr string

The DNS address the ip_address should resolve to.

FloatingIpId int

The Floating IP the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

IpAddress string

The IP address that should point to dns_ptr.

LoadBalancerId int

The Load Balancer the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

ServerId int

The server the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

dnsPtr String

The DNS address the ip_address should resolve to.

floatingIpId Integer

The Floating IP the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

ipAddress String

The IP address that should point to dns_ptr.

loadBalancerId Integer

The Load Balancer the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

serverId Integer

The server the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

dnsPtr string

The DNS address the ip_address should resolve to.

floatingIpId number

The Floating IP the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

ipAddress string

The IP address that should point to dns_ptr.

loadBalancerId number

The Load Balancer the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

serverId number

The server the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

dns_ptr str

The DNS address the ip_address should resolve to.

floating_ip_id int

The Floating IP the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

ip_address str

The IP address that should point to dns_ptr.

load_balancer_id int

The Load Balancer the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

server_id int

The server the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

dnsPtr String

The DNS address the ip_address should resolve to.

floatingIpId Number

The Floating IP the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

ipAddress String

The IP address that should point to dns_ptr.

loadBalancerId Number

The Load Balancer the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

serverId Number

The server the ip_address belongs to. Specify only one of server_id, floating_ip_id and load_balancer_id.

Import

Reverse DNS entries can be imported using a compound ID with the following format<prefix (s for server/ f for floating ip / l for load balancer)>-<server, floating ip or load balancer ID>-<IP address> # import reverse dns entry on server with id 123, ip 192.168.100.1

 $ pulumi import hcloud:index/rdns:Rdns myrdns s-123-192.168.100.1

import reverse dns entry on floating ip with id 123, ip 2001:db8::1

 $ pulumi import hcloud:index/rdns:Rdns myrdns f-123-2001:db8::1

import reverse dns entry on load balancer with id 123, ip 2001:db8::1

 $ pulumi import hcloud:index/rdns:Rdns myrdns l-123-2001:db8::1

Package Details

Repository
https://github.com/pulumi/pulumi-hcloud
License
Apache-2.0
Notes

This Pulumi package is based on the hcloud Terraform Provider.