Hi all,
I have one small issue with each of the three containers for the second challenge. Could you check what I did wrong? I’ve included my resource blocks.
(1) webserver
[x] Bind hostPath /root/code/terraform-challenges/challenge2/lamp_stack/website_content/
to /var/www/html
within webserver container.
resource "docker_container" "php-httpd" {
name = "webserver"
image = "php-httpd:challenge"
hostname = "php-httpd"
networks_advanced {
name = "my_network"
}
ports {
internal = 80
external = 80
ip = "0.0.0.0"
}
mounts {
source = "/root/code/terraform-challenges/challenge2/lamp_stack/website_content/"
target = "/var/www/html"
type = "bind"
}
labels {
label = "challenge"
value = "second"
}
}
(2) db_dashboard
[x] Explicitly specify a dependency on mariadb
terraform resource
resource "docker_container" "phpmyadmin" {
name = "db_dashboard"
image = "phpmyadmin/phpmyadmin"
hostname = "phpmyadmin"
networks_advanced {
name = "my_network"
}
ports {
internal = 80
external = 8081
ip = "0.0.0.0"
}
labels {
label = "challenge"
value = "second"
}
links = ["db"]
depends_on = [
docker_container.mariadb
]
}
(3) db
[x] Define environment variables:
MYSQL_ROOT_PASSWORD=1234
MYSQL_DATABASE=simple-website
iac-server $ cd /root/code/terraform-challenges/challenge2
iac-server $ export TF_VAR_MYSQL_DATABASE="simple-website"
iac-server $ export TF_VAR_MYSQL_ROOT_PASSWORD="1234"