Created
March 8, 2016 18:04
-
-
Save geovanisouza92/fbef3aa9e0ae734350b1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| provider "docker" { | |
| host = "unix:///var/run/docker.sock" | |
| } | |
| resource "docker_image" "mysql_outer" { | |
| name = "mysql:5.7" | |
| } | |
| resource "docker_container" "mysql_outer" { | |
| name = "mysql_outer" | |
| image = "${docker_image.mysql_outer.latest}" | |
| ports { | |
| internal = 3306 | |
| } | |
| } | |
| module "mysql_inner" { | |
| source = "./modules/mysql" | |
| } |
This file contains hidden or 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
| resource "docker_image" "mysql_inner" { | |
| name = "mysql:5.7" | |
| } | |
| resource "docker_container" "mysql_inner" { | |
| name = "mysql_inner" | |
| image = "${docker_image.mysql_inner.latest}" | |
| ports { | |
| internal = 3306 | |
| external = 13306 | |
| } | |
| } |
This file contains hidden or 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 "host" { | |
| value = "${docker_container.mysql_inner.ip_address}" | |
| } | |
| output "port" { | |
| value = "${docker_container.mysql_inner.ports.0.external}" | |
| } | |
| output "address" { | |
| value = "${docker_container.mysql_inner.ip_address}:${docker_container.mysql_inner.ports.0.external}" | |
| } |
This file contains hidden or 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 "mysql_outer_host" { | |
| value = "${docker_container.mysql_outer.ip_address}" | |
| } | |
| output "mysql_outer_port" { | |
| value = "${docker_container.mysql_outer.ports.0.external}" | |
| } | |
| output "mysql_outer_address" { | |
| value = "${docker_container.mysql_outer.ip_address}:${docker_container.mysql_outer.ports.0.external}" | |
| } | |
| output "mysql_inner_host" { | |
| value = "${module.mysql_inner.host}" | |
| } | |
| output "mysql_inner_port" { | |
| value = "${module.mysql_inner.port}" | |
| } | |
| output "mysql_inner_address" { | |
| value = "${module.mysql_inner.address}" | |
| } |
This file contains hidden or 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
| docker_image.mysql_outer: Creating... | |
| latest: "" => "<computed>" | |
| name: "" => "mysql:5.7" | |
| module.mysql_inner.docker_image.mysql_inner: Creating... | |
| latest: "" => "<computed>" | |
| name: "" => "mysql:5.7" | |
| module.mysql_inner.docker_image.mysql_inner: Creation complete | |
| docker_image.mysql_outer: Creation complete | |
| module.mysql_inner.docker_container.mysql_inner: Creating... | |
| bridge: "" => "<computed>" | |
| gateway: "" => "<computed>" | |
| image: "" => "sha256:e13b20a4f248755275fa7db87769cb3c2d25d5d242e1b9946e1e75a2f419217b" | |
| ip_address: "" => "<computed>" | |
| ip_prefix_length: "" => "<computed>" | |
| log_driver: "" => "json-file" | |
| must_run: "" => "1" | |
| name: "" => "mysql_inner" | |
| ports.#: "" => "1" | |
| ports.382260533.external: "" => "13306" | |
| ports.382260533.internal: "" => "3306" | |
| ports.382260533.ip: "" => "" | |
| ports.382260533.protocol: "" => "tcp" | |
| restart: "" => "no" | |
| docker_container.mysql_outer: Creating... | |
| bridge: "" => "<computed>" | |
| gateway: "" => "<computed>" | |
| image: "" => "sha256:e13b20a4f248755275fa7db87769cb3c2d25d5d242e1b9946e1e75a2f419217b" | |
| ip_address: "" => "<computed>" | |
| ip_prefix_length: "" => "<computed>" | |
| log_driver: "" => "json-file" | |
| must_run: "" => "1" | |
| name: "" => "mysql_outer" | |
| ports.#: "" => "1" | |
| ports.275610719.external: "" => "" | |
| ports.275610719.internal: "" => "3306" | |
| ports.275610719.ip: "" => "" | |
| ports.275610719.protocol: "" => "tcp" | |
| restart: "" => "no" | |
| docker_container.mysql_outer: Creation complete | |
| module.mysql_inner.docker_container.mysql_inner: Creation complete | |
| Apply complete! Resources: 4 added, 0 changed, 0 destroyed. | |
| The state of your infrastructure has been saved to the path | |
| below. This state is required to modify and destroy your | |
| infrastructure, so keep it safe. To inspect the complete state | |
| use the `terraform show` command. | |
| State path: terraform.tfstate | |
| Outputs: | |
| mysql_inner_host = 172.17.0.4 | |
| mysql_outer_host = 172.17.0.3 |
This file contains hidden or 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
| Refreshing Terraform state prior to plan... | |
| The Terraform execution plan has been generated and is shown below. | |
| Resources are shown in alphabetical order for quick scanning. Green resources | |
| will be created (or destroyed and then created if an existing resource | |
| exists), yellow resources are being changed in-place, and red resources | |
| will be destroyed. | |
| Note: You didn't specify an "-out" parameter to save this plan, so when | |
| "apply" is called, Terraform can't guarantee this is what will execute. | |
| + docker_container.mysql_outer | |
| bridge: "" => "<computed>" | |
| gateway: "" => "<computed>" | |
| image: "" => "${docker_image.mysql_outer.latest}" | |
| ip_address: "" => "<computed>" | |
| ip_prefix_length: "" => "<computed>" | |
| log_driver: "" => "json-file" | |
| must_run: "" => "1" | |
| name: "" => "mysql_outer" | |
| ports.#: "" => "1" | |
| ports.275610719.external: "" => "" | |
| ports.275610719.internal: "" => "3306" | |
| ports.275610719.ip: "" => "" | |
| ports.275610719.protocol: "" => "tcp" | |
| restart: "" => "no" | |
| + docker_image.mysql_outer | |
| latest: "" => "<computed>" | |
| name: "" => "mysql:5.7" | |
| + module.mysql_inner.docker_container.mysql_inner | |
| bridge: "" => "<computed>" | |
| gateway: "" => "<computed>" | |
| image: "" => "${docker_image.mysql_inner.latest}" | |
| ip_address: "" => "<computed>" | |
| ip_prefix_length: "" => "<computed>" | |
| log_driver: "" => "json-file" | |
| must_run: "" => "1" | |
| name: "" => "mysql_inner" | |
| ports.#: "" => "1" | |
| ports.382260533.external: "" => "13306" | |
| ports.382260533.internal: "" => "3306" | |
| ports.382260533.ip: "" => "" | |
| ports.382260533.protocol: "" => "tcp" | |
| restart: "" => "no" | |
| + module.mysql_inner.docker_image.mysql_inner | |
| latest: "" => "<computed>" | |
| name: "" => "mysql:5.7" | |
| Plan: 4 to add, 0 to change, 0 to destroy. |
This file contains hidden or 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
| docker_container.mysql_outer: | |
| id = f263ccc241e99807ba1d15dcf8281d2f16d017db54740510f2c43febc8908f2c | |
| bridge = | |
| gateway = 172.17.0.1 | |
| image = sha256:e13b20a4f248755275fa7db87769cb3c2d25d5d242e1b9946e1e75a2f419217b | |
| ip_address = 172.17.0.3 | |
| ip_prefix_length = 16 | |
| log_driver = json-file | |
| must_run = true | |
| name = mysql_outer | |
| ports.# = 1 | |
| ports.275610719.external = 0 | |
| ports.275610719.internal = 3306 | |
| ports.275610719.ip = | |
| ports.275610719.protocol = tcp | |
| restart = no | |
| docker_image.mysql_outer: | |
| id = sha256:e13b20a4f248755275fa7db87769cb3c2d25d5d242e1b9946e1e75a2f419217bmysql:5.7 | |
| latest = sha256:e13b20a4f248755275fa7db87769cb3c2d25d5d242e1b9946e1e75a2f419217b | |
| name = mysql:5.7 | |
| module.mysql_inner.docker_container.mysql_inner: | |
| id = 9ba8b352b474a34a467abf7359ba7686c7f4f83033f174d7b9efaf52302e3f7c | |
| bridge = | |
| gateway = 172.17.0.1 | |
| image = sha256:e13b20a4f248755275fa7db87769cb3c2d25d5d242e1b9946e1e75a2f419217b | |
| ip_address = 172.17.0.4 | |
| ip_prefix_length = 16 | |
| log_driver = json-file | |
| must_run = true | |
| name = mysql_inner | |
| ports.# = 1 | |
| ports.382260533.external = 13306 | |
| ports.382260533.internal = 3306 | |
| ports.382260533.ip = | |
| ports.382260533.protocol = tcp | |
| restart = no | |
| module.mysql_inner.docker_image.mysql_inner: | |
| id = sha256:e13b20a4f248755275fa7db87769cb3c2d25d5d242e1b9946e1e75a2f419217bmysql:5.7 | |
| latest = sha256:e13b20a4f248755275fa7db87769cb3c2d25d5d242e1b9946e1e75a2f419217b | |
| name = mysql:5.7 | |
| Outputs: | |
| mysql_inner_host = 172.17.0.4 | |
| mysql_outer_host = 172.17.0.3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment