Skip to content

Commit

Permalink
fix: Add additional output (#7)
Browse files Browse the repository at this point in the history
* fix: Add additional output
* ipv4_address (private)
* ipv4_address (public)

* docs: Generate README.md

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
dhoppe and github-actions[bot] authored Jan 17, 2022
1 parent bbe6f6d commit b16d9aa
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 5 deletions.
25 changes: 23 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Terraform module to manage the Hetzner Cloud resource (hcloud_server, hcloud_ser

Copy and paste into your Terraform configuration, insert the variables and run ```terraform init```:

**Create one server:**
**Create one server (only public IP):**

```hcl
module "hcloud-server" {
Expand All @@ -22,6 +22,22 @@ module "hcloud-server" {
}
```

**Create one server (plus private IP):**

```hcl
module "hcloud-server" {
source = "dhoppeIT/server/hcloud"
name = "debian"
server_type = "cx11"
image = "debian-10"
create_server_network = true
network_id = 1331495
ip = cidrhost("10.0.0.0/24", 2)
}
```

**Create multiple servers:**

```hcl
Expand All @@ -32,6 +48,10 @@ module "hcloud-server" {
name = format("debian%02d", count.index + 1)
server_type = "cx11"
image = "debian-10"
create_server_network = true
subnet_id = "1331495-10.0.0.0/24"
ip = cidrhost("10.0.0.0/24", 10 + count.index)
}
```

Expand Down Expand Up @@ -90,7 +110,8 @@ No modules.
| Name | Description |
|------|-------------|
| <a name="output_id"></a> [id](#output\_id) | Unique ID of the server |
| <a name="output_ipv4_address"></a> [ipv4\_address](#output\_ipv4\_address) | The IPv4 address |
| <a name="output_ipv4_address_private"></a> [ipv4\_address\_private](#output\_ipv4\_address\_private) | The private IPv4 address |
| <a name="output_ipv4_address_public"></a> [ipv4\_address\_public](#output\_ipv4\_address\_public) | The public IPv4 address |
| <a name="output_name"></a> [name](#output\_name) | Name of the server |

<!--- END_TF_DOCS --->
Expand Down
9 changes: 7 additions & 2 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ output "name" {
value = hcloud_server.default.name
}

output "ipv4_address" {
description = "The IPv4 address"
output "ipv4_address_public" {
description = "The public IPv4 address"
value = hcloud_server.default.ipv4_address
}

output "ipv4_address_private" {
description = "The private IPv4 address"
value = try(hcloud_server_network.default[0].ip, "")
}
Loading

0 comments on commit b16d9aa

Please sign in to comment.