docs(network): update ds descriptions

This commit is contained in:
Manuel Vogel 2021-05-13 08:40:54 +02:00
parent 402391f670
commit 208b733bae
No known key found for this signature in database
GPG key ID: 24E54F214569A8A5
6 changed files with 91 additions and 32 deletions

View file

@ -3,14 +3,20 @@
page_title: "docker_network Data Source - terraform-provider-docker"
subcategory: ""
description: |-
docker_network provides details about a specific Docker Network.
---
# docker_network (Data Source)
`docker_network` provides details about a specific Docker Network.
## Example Usage
```terraform
data "docker_network" "main" {
name = "main"
}
```
<!-- schema generated by tfplugindocs -->
## Schema
@ -18,15 +24,15 @@ description: |-
### Optional
- **id** (String) The ID of this resource.
- **name** (String)
- **name** (String) The name of the Docker network.
### Read-Only
- **driver** (String)
- **internal** (Boolean)
- **ipam_config** (Set of Object) (see [below for nested schema](#nestedatt--ipam_config))
- **options** (Map of String)
- **scope** (String)
- **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))
- **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`.
<a id="nestedatt--ipam_config"></a>
### Nested Schema for `ipam_config`

View file

@ -10,7 +10,23 @@ description: |-
## Example Usage
```terraform
provider "docker" {
host = "tcp://127.0.0.1:2376/"
}
# Create a container
resource "docker_container" "foo" {
image = docker_image.ubuntu.latest
name = "foo"
}
resource "docker_image" "ubuntu" {
name = "ubuntu:latest"
}
```
<!-- schema generated by tfplugindocs -->
## Schema

9
examples/README.md Normal file
View file

@ -0,0 +1,9 @@
# Examples
This directory contains examples that are mostly used for documentation, but can also be run/tested manually via the Terraform CLI.
The document generation tool looks for files in the following locations by default. All other *.tf files besides the ones mentioned below are ignored by the documentation tool. This is useful for creating examples that can run and/or ar testable even if some parts are not relevant for the documentation.
* **provider/provider.tf** example file for the provider index page
* **data-sources/<full data source name>/data-source.tf** example file for the named data source page
* **resources/<full resource name>/resource.tf** example file for the named data source page

View file

@ -0,0 +1,3 @@
data "docker_network" "main" {
name = "main"
}

View file

@ -0,0 +1,13 @@
provider "docker" {
host = "tcp://127.0.0.1:2376/"
}
# Create a container
resource "docker_container" "foo" {
image = docker_image.ubuntu.latest
name = "foo"
}
resource "docker_image" "ubuntu" {
name = "ubuntu:latest"
}

View file

@ -12,12 +12,15 @@ import (
func dataSourceDockerNetwork() *schema.Resource {
return &schema.Resource{
Description: "`docker_network` provides details about a specific Docker Network.",
ReadContext: dataSourceDockerNetworkRead,
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Optional: true,
Type: schema.TypeString,
Description: "The name of the Docker network.",
Optional: true,
},
"id": {
@ -26,55 +29,64 @@ func dataSourceDockerNetwork() *schema.Resource {
},
"driver": {
Type: schema.TypeString,
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.",
Computed: true,
},
"options": {
Type: schema.TypeMap,
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.",
Computed: true,
},
"internal": {
Type: schema.TypeBool,
Computed: true,
Type: schema.TypeBool,
Description: "Whether the network is internal.",
Computed: true,
},
"ipam_config": {
Type: schema.TypeSet,
Computed: true,
Type: schema.TypeSet,
Description: "IPAM configuration options",
Computed: true,
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,
},
},
}