diff --git a/README.md b/README.md
index f216bcc..b0cfee0 100644
--- a/README.md
+++ b/README.md
@@ -46,7 +46,6 @@ No modules.
| [digitalocean_firewall.ssh](https://registry.terraform.io/providers/digitalocean/digitalocean/2.21.0/docs/resources/firewall) | resource |
| [digitalocean_loadbalancer.external](https://registry.terraform.io/providers/digitalocean/digitalocean/2.21.0/docs/resources/loadbalancer) | resource |
| [digitalocean_project_resources.agent_droplets](https://registry.terraform.io/providers/digitalocean/digitalocean/2.21.0/docs/resources/project_resources) | resource |
-| [digitalocean_project_resources.consul_volumes](https://registry.terraform.io/providers/digitalocean/digitalocean/2.21.0/docs/resources/project_resources) | resource |
| [digitalocean_project_resources.network](https://registry.terraform.io/providers/digitalocean/digitalocean/2.21.0/docs/resources/project_resources) | resource |
| [digitalocean_project_resources.server_droplets](https://registry.terraform.io/providers/digitalocean/digitalocean/2.21.0/docs/resources/project_resources) | resource |
| [digitalocean_record.server](https://registry.terraform.io/providers/digitalocean/digitalocean/2.21.0/docs/resources/record) | resource |
@@ -65,6 +64,7 @@ No modules.
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [agents](#input\_agents) | number of agent instances | `number` | `7` | no |
+| [consul\_version](#input\_consul\_version) | Version of Consul to deploy | `string` | `"1.12.3"` | no |
| [datacenter](#input\_datacenter) | Name of the Consul datacenter | `string` | `"HashiDO"` | no |
| [droplet\_size](#input\_droplet\_size) | Size of the droplet for Vault instances | `string` | `"s-1vcpu-1gb"` | no |
| [project\_name](#input\_project\_name) | Name of the project in digitalocean | `string` | `"hashi"` | no |
@@ -72,7 +72,6 @@ No modules.
| [ssh\_inbound\_source\_cidrs](#input\_ssh\_inbound\_source\_cidrs) | List of CIDRs from which we will allow ssh connections on port 22 | `list(any)` | `[]` | no |
| [ssh\_public\_key\_url](#input\_ssh\_public\_key\_url) | URL of of the public ssh key to add to the droplet | `string` | `"https://github.com/brucellino.keys"` | no |
| [username](#input\_username) | Name of the non-root user to add | `string` | `"hashiuser"` | no |
-| [vpc](#input\_vpc) | VPC we are deploying into | `string` | n/a | yes |
| [vpc\_name](#input\_vpc\_name) | Name of the VPC we are deploying into | `string` | `"hashi"` | no |
## Outputs
diff --git a/main.tf b/main.tf
index 54ff2f4..4204e1a 100644
--- a/main.tf
+++ b/main.tf
@@ -117,7 +117,7 @@ resource "digitalocean_droplet" "agent" {
user_data = templatefile(
"${path.module}/templates/userdata.tftpl",
{
- consul_version = "1.12.3"
+ consul_version = var.consul_version
server = false
username = var.username
datacenter = var.datacenter
@@ -220,7 +220,7 @@ resource "digitalocean_domain" "cluster" {
}
resource "digitalocean_record" "server" {
- count = 3
+ count = var.servers
type = "A"
value = digitalocean_droplet.server[count.index].ipv4_address_private
name = digitalocean_droplet.server[count.index].name
@@ -236,10 +236,11 @@ resource "digitalocean_project_resources" "agent_droplets" {
resources = digitalocean_droplet.agent[*].urn
}
-resource "digitalocean_project_resources" "consul_volumes" {
- project = data.digitalocean_project.p.id
- resources = digitalocean_volume.consul_data[*].urn
-}
+# resource "digitalocean_project_resources" "consul_volumes" {
+# depends_on = digitalocean_project_resources.agent_droplets
+# project = data.digitalocean_project.p.id
+# resources = digitalocean_volume.consul_data[*].urn
+# }
resource "digitalocean_project_resources" "network" {
diff --git a/variables.tf b/variables.tf
index 17f4358..4499756 100644
--- a/variables.tf
+++ b/variables.tf
@@ -1,18 +1,15 @@
# consul-digitalocean variables.tf
-variable "vpc" {
- type = string
- description = "VPC we are deploying into"
-}
-
variable "servers" {
type = number
default = 3
description = "number of server instances"
+ # validation = must be prime number less than 7
}
variable "agents" {
type = number
default = 7
description = "number of agent instances"
+ # validation = must be > 0
}
variable "project_name" {
@@ -31,18 +28,21 @@ variable "ssh_inbound_source_cidrs" {
type = list(any)
description = "List of CIDRs from which we will allow ssh connections on port 22"
default = []
+ # validation = must not be 0.0.0.0/0
}
variable "ssh_public_key_url" {
type = string
description = "URL of of the public ssh key to add to the droplet"
default = "https://github.com/brucellino.keys"
+ # Pre-condition in data.
}
variable "droplet_size" {
type = string
description = "Size of the droplet for Vault instances"
default = "s-1vcpu-1gb"
+ # validation = must be in digitalocean droplet sizes
}
variable "username" {
@@ -51,6 +51,12 @@ variable "username" {
default = "hashiuser"
}
+variable "consul_version" {
+ description = "Version of Consul to deploy"
+ type = string
+ default = "1.12.3"
+}
+
variable "datacenter" {
type = string
description = "Name of the Consul datacenter"