diff --git a/docs/data-sources/network.md b/docs/data-sources/network.md
index c4c92009..d5093a86 100644
--- a/docs/data-sources/network.md
+++ b/docs/data-sources/network.md
@@ -30,7 +30,7 @@ data "docker_network" "main" {
- **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.
- **internal** (Boolean) Whether the network is internal.
-- **ipam_config** (Set of Object) IPAM configuration options (see [below for nested schema](#nestedatt--ipam_config))
+- **ipam_config** (Set of Object) The IPAM configuration options (see [below for nested schema](#nestedatt--ipam_config))
- **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.
- **scope** (String) Scope of the network. One of `swarm`, `global`, or `local`.
diff --git a/docs/resources/network.md b/docs/resources/network.md
index 1dd15a35..c56c9fc1 100644
--- a/docs/resources/network.md
+++ b/docs/resources/network.md
@@ -3,49 +3,55 @@
page_title: "docker_network Resource - terraform-provider-docker"
subcategory: ""
description: |-
-
+ docker_network provides details about a specific Docker Network.
---
# docker_network (Resource)
+`docker_network` provides details about a specific Docker Network.
+## Example Usage
-
+```terraform
+resource "docker_network" "private_network" {
+ name = "my_network"
+}
+```
## Schema
### Required
-- **name** (String)
+- **name** (String) The name of the Docker network.
### Optional
-- **attachable** (Boolean)
-- **check_duplicate** (Boolean)
-- **driver** (String)
+- **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)
-- **internal** (Boolean)
-- **ipam_config** (Block Set) (see [below for nested schema](#nestedblock--ipam_config))
-- **ipam_driver** (String)
-- **ipv6** (Boolean)
-- **labels** (Block Set) (see [below for nested schema](#nestedblock--labels))
-- **options** (Map of String)
+- **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.
+- **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** (String) Scope of the network. One of `swarm`, `global`, or `local`.
### Nested Schema for `ipam_config`
Optional:
-- **aux_address** (Map of String)
-- **gateway** (String)
-- **ip_range** (String)
-- **subnet** (String)
+- **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
diff --git a/examples/resources/docker_network/resource.tf b/examples/resources/docker_network/resource.tf
new file mode 100644
index 00000000..448b7493
--- /dev/null
+++ b/examples/resources/docker_network/resource.tf
@@ -0,0 +1,3 @@
+resource "docker_network" "private_network" {
+ name = "my_network"
+}
\ No newline at end of file
diff --git a/internal/provider/data_source_docker_network.go b/internal/provider/data_source_docker_network.go
index 65a9ec85..5bf9ec19 100644
--- a/internal/provider/data_source_docker_network.go
+++ b/internal/provider/data_source_docker_network.go
@@ -48,7 +48,7 @@ func dataSourceDockerNetwork() *schema.Resource {
"ipam_config": {
Type: schema.TypeSet,
- Description: "IPAM configuration options",
+ Description: "The IPAM configuration options",
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
diff --git a/internal/provider/resource_docker_network.go b/internal/provider/resource_docker_network.go
index 71aae763..0ee591cd 100644
--- a/internal/provider/resource_docker_network.go
+++ b/internal/provider/resource_docker_network.go
@@ -12,6 +12,8 @@ import (
func resourceDockerNetwork() *schema.Resource {
return &schema.Resource{
+ Description: "`docker_network` provides details about a specific Docker Network.",
+
CreateContext: resourceDockerNetworkCreate,
ReadContext: resourceDockerNetworkRead,
DeleteContext: resourceDockerNetworkDelete,
@@ -21,108 +23,124 @@ func resourceDockerNetwork() *schema.Resource {
Schema: map[string]*schema.Schema{
"name": {
- Type: schema.TypeString,
- Required: true,
- ForceNew: true,
+ Type: schema.TypeString,
+ Description: "The name of the Docker network.",
+ Required: true,
+ ForceNew: true,
},
"labels": {
- Type: schema.TypeSet,
- Optional: true,
- ForceNew: true,
- Elem: labelSchema,
+ Type: schema.TypeSet,
+ Description: "User-defined key/value metadata",
+ Optional: true,
+ ForceNew: true,
+ Elem: labelSchema,
},
"check_duplicate": {
- Type: schema.TypeBool,
- Optional: true,
- ForceNew: true,
+ Type: schema.TypeBool,
+ Description: "Requests daemon to check for networks with same name.",
+ Optional: true,
+ ForceNew: true,
},
"driver": {
- Type: schema.TypeString,
- Optional: true,
- ForceNew: true,
- Computed: true,
+ Type: schema.TypeString,
+ Description: "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.",
+ Optional: true,
+ ForceNew: true,
+ Computed: true,
},
"options": {
- Type: schema.TypeMap,
- Optional: true,
- ForceNew: true,
- Computed: true,
+ Type: schema.TypeMap,
+ Description: "Only available with bridge networks. See [bridge options docs](https://docs.docker.com/engine/reference/commandline/network_create/#bridge-driver-options) for more details.",
+ Optional: true,
+ ForceNew: true,
+ Computed: true,
},
"internal": {
- Type: schema.TypeBool,
- Optional: true,
- Computed: true,
- ForceNew: true,
+ Type: schema.TypeBool,
+ Description: "Whether the network is internal.",
+ Optional: true,
+ Computed: true,
+ ForceNew: true,
},
"attachable": {
- Type: schema.TypeBool,
- Optional: true,
- ForceNew: true,
+ Type: schema.TypeBool,
+ Description: "Enable manual container attachment to the network.",
+ Optional: true,
+ ForceNew: true,
},
"ingress": {
- Type: schema.TypeBool,
- Optional: true,
- ForceNew: true,
+ Type: schema.TypeBool,
+ Description: "Create swarm routing-mesh network.Defaults to `false`.",
+ Optional: true,
+ ForceNew: true,
},
"ipv6": {
- Type: schema.TypeBool,
- Optional: true,
- ForceNew: true,
+ Type: schema.TypeBool,
+ Description: "Enable IPv6 networking. Defaults to `false`.",
+ Optional: true,
+ ForceNew: true,
},
"ipam_driver": {
- Type: schema.TypeString,
- Optional: true,
- ForceNew: true,
- Default: "default",
+ Type: schema.TypeString,
+ Description: "Driver used by the custom IP scheme of the network.",
+ Optional: true,
+ ForceNew: true,
+ Default: "default",
},
"ipam_config": {
- Type: schema.TypeSet,
- Optional: true,
- Computed: true,
- ForceNew: true,
+ Type: schema.TypeSet,
+ Description: "The IPAM configuration options",
+ Optional: true,
+ Computed: true,
+ ForceNew: true,
// DiffSuppressFunc: suppressIfIPAMConfigWithIpv6Changes(),
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"subnet": {
- Type: schema.TypeString,
- Optional: true,
- ForceNew: true,
+ Type: schema.TypeString,
+ Description: "The subnet in CIDR form",
+ Optional: true,
+ ForceNew: true,
},
"ip_range": {
- Type: schema.TypeString,
- Optional: true,
- ForceNew: true,
+ Type: schema.TypeString,
+ Description: "The ip range in CIDR form",
+ Optional: true,
+ ForceNew: true,
},
"gateway": {
- Type: schema.TypeString,
- Optional: true,
- ForceNew: true,
+ Type: schema.TypeString,
+ Description: "The IP address of the gateway",
+ Optional: true,
+ ForceNew: true,
},
"aux_address": {
- Type: schema.TypeMap,
- Optional: true,
- ForceNew: true,
+ Type: schema.TypeMap,
+ Description: "Auxiliary IPv4 or IPv6 addresses used by Network driver",
+ Optional: true,
+ ForceNew: true,
},
},
},
},
"scope": {
- Type: schema.TypeString,
- Computed: true,
+ Type: schema.TypeString,
+ Description: "Scope of the network. One of `swarm`, `global`, or `local`.",
+ Computed: true,
},
},
SchemaVersion: 1,