Reputation: 11
I'm in the process of building out some of my Docker Compose containers via Terraform. The two containers are required to join a new external docker network, which I previously configured in the docker-compose.yml of each container with;
networks:
proxy:
external: true
I've tried various ways to set the network as external (including current example below attempting to label), but on creation this does not seem to be getting configured at the container level. I haven't been able to find a way to declare this - any thoughts?
resource "docker_network" "proxy2" {
name = "proxy2"
driver = "bridge"
labels {
label = "external"
value = true
}
}
Upvotes: 1
Views: 355
Reputation: 18203
Based on the documentation for the Docker network resource, it seems that the network is made external by using the internal
argument and setting it to false
:
resource "docker_network" "proxy2" {
name = "proxy2"
driver = "bridge"
internal = false
}
Upvotes: 1