Skip to content

Commit

Permalink
Comment out ipv6 private address DNS records, add user-data to simple…
Browse files Browse the repository at this point in the history
… example
  • Loading branch information
pysysops committed Jan 17, 2019
1 parent 14c3d70 commit a534f12
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 20 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ Run `terraform destroy` when you don't need these resources.
| loadbalancer\_ip | IP address of the loadbalancer |
| name | List of names of Droplets |
| private\_a | List of Droplet private DNS A record FQDNs. |
| private\_aaaa | List of Droplet private DNS AAAA record FQDNs. |
| public\_a | List of Droplet public DNS A record FQDNs. |
| public\_aaaa | List of Droplet public DNS AAAA record FQDNs. |
| region | List of regions of Droplets |
Expand Down
1 change: 1 addition & 0 deletions examples/simple/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ module "web" {
floating_ip = true
block_storage_size = 5
tags = ["${digitalocean_tag.ENV_example.id}", "${digitalocean_tag.ROLE_web.id}"]
user_data = "${file("user-data.web")}"
}
5 changes: 5 additions & 0 deletions examples/simple/user-data.web
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#cloud-config

runcmd:
- apt-get install -y nginx
- 'echo "<html><body><h2>$(hostname)</h2></body></html>" > /var/www/html/index.html'
18 changes: 10 additions & 8 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,14 @@ resource "digitalocean_record" "private_a" {
value = "${element(digitalocean_droplet.droplet.*.ipv4_address_private, count.index)}"
}

// Private DNS AAAA Record
resource "digitalocean_record" "private_aaaa" {
count = "${var.private_networking > 0 && var.ipv6 > 0 && var.private_domain != "" ? var.droplet_count : 0}"
// Private DNS AAAA Record - Not supported somewhere:
// https://github.com/terraform-providers/terraform-provider-digitalocean/issues/181
// resource "digitalocean_record" "private_aaaa" {
// count = "${var.private_networking > 0 && var.ipv6 > 0 && var.private_domain != "" ? var.droplet_count : 0}"
//
// domain = "${var.private_domain}"
// type = "AAAA"
// name = "${element(digitalocean_droplet.droplet.*.name, count.index)}"
// value = "${element(digitalocean_droplet.droplet.*.ipv6_address_private, count.index)}"
// }

domain = "${var.private_domain}"
type = "AAAA"
name = "${element(digitalocean_droplet.droplet.*.name, count.index)}"
value = "${element(digitalocean_droplet.droplet.*.ipv6_address_private, count.index)}"
}
23 changes: 12 additions & 11 deletions output.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ locals {
loadbalancer_id = "${compact(concat(digitalocean_loadbalancer.loadbalancer.*.id, list("")))}"
loadbalancer_ip = "${compact(concat(digitalocean_loadbalancer.loadbalancer.*.ip, list("")))}"
private_a = "${compact(concat(digitalocean_record.private_a.*.fqdn, list("")))}"
private_aaaa = "${compact(concat(digitalocean_record.private_aaaa.*.fqdn, list("")))}"
public_a = "${compact(concat(digitalocean_record.public_a.*.fqdn, list("")))}"
public_aaaa = "${compact(concat(digitalocean_record.public_aaaa.*.fqdn, list("")))}"
volume_id = "${compact(concat(digitalocean_volume.volume.*.id, list("")))}"
volume_filesystem_type = "${compact(concat(digitalocean_volume.volume.*.initial_filesystem_type, list("")))}"
volume_droplet_ids = "${compact(concat(flatten(digitalocean_volume.volume.*.droplet_ids), list("")))}"
volume_attachment_id = "${compact(concat(digitalocean_volume_attachment.volume_attachment.*.id, list("")))}"

// private_aaaa = "${compact(concat(digitalocean_record.private_aaaa.*.fqdn, list("")))}"
public_a = "${compact(concat(digitalocean_record.public_a.*.fqdn, list("")))}"
public_aaaa = "${compact(concat(digitalocean_record.public_aaaa.*.fqdn, list("")))}"
volume_id = "${compact(concat(digitalocean_volume.volume.*.id, list("")))}"
volume_filesystem_type = "${compact(concat(digitalocean_volume.volume.*.initial_filesystem_type, list("")))}"
volume_droplet_ids = "${compact(concat(flatten(digitalocean_volume.volume.*.droplet_ids), list("")))}"
volume_attachment_id = "${compact(concat(digitalocean_volume_attachment.volume_attachment.*.id, list("")))}"
}

output "droplet_id" {
Expand Down Expand Up @@ -87,10 +88,10 @@ output "private_a" {
value = ["${local.private_a}"]
}

output "private_aaaa" {
description = "List of Droplet private DNS AAAA record FQDNs."
value = ["${local.private_aaaa}"]
}
// output "private_aaaa" {
// description = "List of Droplet private DNS AAAA record FQDNs."
// value = ["${local.private_aaaa}"]
// }

output "public_a" {
description = "List of Droplet public DNS A record FQDNs."
Expand Down

0 comments on commit a534f12

Please sign in to comment.