Created
March 29, 2018 07:03
-
-
Save derekm1215/619ff3df138311b50b5e70dfb7315b94 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Download the latest Ghost Image | |
resource "docker_image" "image_id" { | |
name = "${var.image}" | |
} | |
# Start the Container | |
resource "docker_container" "container_id" { | |
name = "${var.container_name}" | |
image = "${docker_image.image_id.latest}" | |
ports { | |
internal = "${var.int_port}" | |
external = "${var.ext_port}" | |
} | |
} | |
#Output the IP Address of the Container | |
output "IP Address" { | |
value = "${docker_container.container_id.ip_address}" | |
} | |
output "container_name" { | |
value = "${docker_container.container_id.name}" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Output the IP Address of the Container | |
output "ip" { | |
value = "${docker_container.container_id.ip_address}" | |
} | |
output "container_name" { | |
value = "${docker_container.container_id.name}" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
variable "container_name" { | |
description = "Name of container" | |
default = "blog" | |
} | |
variable "image" { | |
description = "image for container" | |
default = "ghost:latest" | |
} | |
variable "int_port" { | |
description = "internal port for container" | |
default = "2368" | |
} | |
variable "ext_port" { | |
description = "external port for container" | |
default = "80" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment