mirror of
https://github.com/kreuzwerker/terraform-provider-docker.git
synced 2025-12-20 22:59:42 -05:00
3 KiB
3 KiB
| page_title | subcategory | description |
|---|---|---|
| Resource docker_network - terraform-provider-docker | docker_network provides a docker network resource. |
Resource (docker_network)
docker_network provides a docker network resource.
Example Usage
resource "docker_network" "private_network" {
name = "my_network"
}
Schema
Required
name(String) The name of the Docker network.
Optional
attachable(Boolean) Enable manual container attachment to the network.check_duplicate(Boolean) Requests daemon to check for networks with same name.driver(String) The driver of the Docker network. Possible values arebridge,host,overlay,macvlan. See network docs for more details.ingress(Boolean) Create swarm routing-mesh network. Defaults tofalse.internal(Boolean) Whether the network is internal.ipam_config(Block Set) The IPAM configuration options (see below for nested schema)ipam_driver(String) Driver used by the custom IP scheme of the network. Defaults todefaultipam_options(Map of String) Provide explicit options to the IPAM driver. Valid options vary withipam_driverand refer to that driver's documentation for more details.ipv6(Boolean) Enable IPv6 networking. Defaults tofalse.labels(Block Set) User-defined key/value metadata (see below for nested schema)options(Map of String) Only available with bridge networks. See bridge options docs for more details.
Read-Only
id(String) The ID of this resource.scope(String) Scope of the network. One ofswarm,global, orlocal.
Nested Schema for ipam_config
Optional:
aux_address(Map of String) Auxiliary IPv4 or IPv6 addresses used by Network drivergateway(String) The IP address of the gatewayip_range(String) The ip range in CIDR formsubnet(String) The subnet in CIDR form
Nested Schema for labels
Required:
label(String) Name of the labelvalue(String) Value of the label
Import
Import is supported using the following syntax by providing the id:
#!/bin/bash
terraform import docker_network.foo id
Example
Assuming you created a network as follows
#!/bin/bash
docker network create foo
# prints the long ID
87b57a9b91ecab2db2a6dbf38df74c67d7c7108cbe479d6576574ec2cd8c2d73
you provide the definition for the resource as follows
resource "docker_network" "foo" {
name = "foo"
}
then the import command is as follows
#!/bin/bash
terraform import docker_network.foo 87b57a9b91ecab2db2a6dbf38df74c67d7c7108cbe479d6576574ec2cd8c2d73