mirror of
https://github.com/kreuzwerker/terraform-provider-docker.git
synced 2025-12-21 23:29:59 -05:00
98 lines
2.9 KiB
Markdown
98 lines
2.9 KiB
Markdown
|
|
---
|
||
|
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||
|
|
page_title: "docker_network Resource - terraform-provider-docker"
|
||
|
|
subcategory: ""
|
||
|
|
description: |-
|
||
|
|
docker_network provides details about a specific Docker Network.
|
||
|
|
---
|
||
|
|
<!-- Bug: Type and Name are switched -->
|
||
|
|
# docker_network (Resource)
|
||
|
|
|
||
|
|
`docker_network` provides details about a specific Docker Network.
|
||
|
|
|
||
|
|
## Example Usage
|
||
|
|
|
||
|
|
```terraform
|
||
|
|
resource "docker_network" "private_network" {
|
||
|
|
name = "my_network"
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
<!-- schema generated by tfplugindocs -->
|
||
|
|
## 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 are `bridge`, `host`, `overlay`, `macvlan`. See [network docs](https://docs.docker.com/network/#network-drivers) for more details.
|
||
|
|
- **id** (String) The ID of this resource.
|
||
|
|
- **ingress** (Boolean) Create swarm routing-mesh network. Defaults to `false`.
|
||
|
|
- **internal** (Boolean) Whether the network is internal.
|
||
|
|
- **ipam_config** (Block Set) The IPAM configuration options (see [below for nested schema](#nestedblock--ipam_config))
|
||
|
|
- **ipam_driver** (String) Driver used by the custom IP scheme of the network. Defaults to `default`
|
||
|
|
- **ipv6** (Boolean) Enable IPv6 networking. Defaults to `false`.
|
||
|
|
- **labels** (Block Set) User-defined key/value metadata (see [below for nested schema](#nestedblock--labels))
|
||
|
|
- **options** (Map of String) Only available with bridge networks. See [bridge options docs](https://docs.docker.com/engine/reference/commandline/network_create/#bridge-driver-options) for more details.
|
||
|
|
|
||
|
|
### Read-Only
|
||
|
|
|
||
|
|
- **scope** (String) Scope of the network. One of `swarm`, `global`, or `local`.
|
||
|
|
|
||
|
|
<a id="nestedblock--ipam_config"></a>
|
||
|
|
### Nested Schema for `ipam_config`
|
||
|
|
|
||
|
|
Optional:
|
||
|
|
|
||
|
|
- **aux_address** (Map of String) Auxiliary IPv4 or IPv6 addresses used by Network driver
|
||
|
|
- **gateway** (String) The IP address of the gateway
|
||
|
|
- **ip_range** (String) The ip range in CIDR form
|
||
|
|
- **subnet** (String) The subnet in CIDR form
|
||
|
|
|
||
|
|
|
||
|
|
<a id="nestedblock--labels"></a>
|
||
|
|
### Nested Schema for `labels`
|
||
|
|
|
||
|
|
Required:
|
||
|
|
|
||
|
|
- **label** (String) Name of the label
|
||
|
|
- **value** (String) Value of the label
|
||
|
|
|
||
|
|
## Import
|
||
|
|
|
||
|
|
Import is supported using the following syntax by providing the `id`:
|
||
|
|
|
||
|
|
```shell
|
||
|
|
#!/bin/bash
|
||
|
|
terraform import docker_network.foo id
|
||
|
|
```
|
||
|
|
|
||
|
|
### Example
|
||
|
|
|
||
|
|
Assuming you created a `network` as follows
|
||
|
|
|
||
|
|
```shell
|
||
|
|
#!/bin/bash
|
||
|
|
docker network create foo
|
||
|
|
# prints the long ID
|
||
|
|
87b57a9b91ecab2db2a6dbf38df74c67d7c7108cbe479d6576574ec2cd8c2d73
|
||
|
|
```
|
||
|
|
|
||
|
|
you provide the definition for the resource as follows
|
||
|
|
|
||
|
|
```terraform
|
||
|
|
resource "docker_network" "foo" {
|
||
|
|
name = "foo"
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
then the import command is as follows
|
||
|
|
|
||
|
|
```shell
|
||
|
|
#!/bin/bash
|
||
|
|
terraform import docker_network.foo 87b57a9b91ecab2db2a6dbf38df74c67d7c7108cbe479d6576574ec2cd8c2d73
|
||
|
|
```
|