Skip to content

Commit

Permalink
Experimental Terraform for Docker w/ Consul
Browse files Browse the repository at this point in the history
  • Loading branch information
Ted Behling committed Aug 14, 2020
1 parent aad1c1e commit cbf3316
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
26 changes: 26 additions & 0 deletions consul/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
resource "docker_network" "consul_network" {
name = "consul_network"
}

resource "docker_image" "consul" {
name = "consul:1.2.3"
}

resource "docker_container" "consul1" {
name = "consul1"
image = docker_image.consul.latest
command = ["agent", "-server", "-bootstrap-expect=1"]
hostname = "consul1"
publish_all_ports = true
networks_advanced {
name = docker_network.consul_network.name
}
}

output "consul1_docker_id" {
value = docker_container.consul1.id
}

output "consul1_ip" {
value = docker_container.consul1.network_data[0].ip_address
}
8 changes: 8 additions & 0 deletions consul/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
terraform {
required_providers {
docker = {
source = "terraform-providers/docker"
}
}
required_version = ">= 0.13"
}

0 comments on commit cbf3316

Please sign in to comment.