Skip to content

Commit 9145096

Browse files
authored
Merge pull request #54 from hashicorp/cleanup
Change to doc generation
2 parents 581c73f + b26a38c commit 9145096

File tree

1,131 files changed

+258925
-5102
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,131 files changed

+258925
-5102
lines changed

README.md

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
Terraform `null` Provider
22
=========================
33

4-
- Website: https://www.terraform.io
5-
- [![Gitter chat](https://badges.gitter.im/hashicorp-terraform/Lobby.png)](https://gitter.im/hashicorp-terraform/Lobby)
6-
- Mailing list: [Google Groups](http://groups.google.com/group/terraform-tool)
7-
8-
<img src="https://cdn.rawgit.com/hashicorp/terraform-website/master/content/source/assets/images/logo-hashicorp.svg" width="600px">
4+
See the documentation for this provider on the [Terraform Registry](https://registry.terraform.io/providers/hashicorp/null/latest/docs) for usage information.
95

106
Maintainers
117
-----------
@@ -34,14 +30,13 @@ $ cd $GOPATH/src/github.com/terraform-providers/terraform-provider-null
3430
$ make build
3531
```
3632

37-
Using the provider
38-
----------------------
39-
## Fill in for each provider
4033

4134
Developing the Provider
4235
---------------------------
4336

44-
If you wish to work on the provider, you'll first need [Go](http://www.golang.org) installed on your machine (version 1.11+ is *required*). You'll also need to correctly setup a [GOPATH](http://golang.org/doc/code.html#GOPATH), as well as adding `$GOPATH/bin` to your `$PATH`.
37+
If you wish to work on the provider, you'll first need [Go](http://www.golang.org) installed on your machine (version 1.15+ is *required*).
38+
39+
To generate the documentation, run `go generate` in the root of the codebase.
4540

4641
To compile the provider, run `make build`. This will build the provider and put the provider binary in the `$GOPATH/bin` directory.
4742

docs/data-sources/data_source.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "null_data_source Data Source - terraform-provider-null"
4+
subcategory: ""
5+
description: |-
6+
The null_data_source data source implements the standard data source lifecycle but does not
7+
interact with any external APIs.
8+
Historically, the null_data_source was typically used to construct intermediate values to re-use elsewhere in configuration. The
9+
same can now be achieved using locals https://www.terraform.io/docs/language/values/locals.html.
10+
---
11+
12+
# null_data_source
13+
14+
The `null_data_source` data source implements the standard data source lifecycle but does not
15+
interact with any external APIs.
16+
17+
Historically, the `null_data_source` was typically used to construct intermediate values to re-use elsewhere in configuration. The
18+
same can now be achieved using [locals](https://www.terraform.io/docs/language/values/locals.html).
19+
20+
## Example Usage
21+
22+
```terraform
23+
data "null_data_source" "values" {
24+
inputs = {
25+
all_server_ids = concat(aws_instance.green.*.id, aws_instance.blue.*.id)
26+
all_server_ips = concat(aws_instance.green.*.private_ip, aws_instance.blue.*.private_ip)
27+
}
28+
}
29+
30+
resource "aws_elb" "main" {
31+
# ...
32+
33+
instances = data.null_data_source.values.outputs["all_server_ids"]
34+
}
35+
36+
output "all_server_ids" {
37+
value = data.null_data_source.values.outputs["all_server_ids"]
38+
}
39+
40+
output "all_server_ips" {
41+
value = data.null_data_source.values.outputs["all_server_ips"]
42+
}
43+
```
44+
45+
<!-- schema generated by tfplugindocs -->
46+
## Schema
47+
48+
### Optional
49+
50+
- **has_computed_default** (String) If set, its literal value will be stored and returned. If not, its value defaults to `"default"`. This argument exists primarily for testing and has little practical use.
51+
- **inputs** (Map of String) A map of arbitrary strings that is copied into the `outputs` attribute, and accessible directly for interpolation.
52+
53+
### Read-Only
54+
55+
- **id** (String, Deprecated) This attribute is only present for some legacy compatibility issues and should not be used. It will be removed in a future version.
56+
- **outputs** (Map of String) After the data source is "read", a copy of the `inputs` map.
57+
- **random** (String) A random value. This is primarily for testing and has little practical use; prefer the [hashicorp/random provider](https://registry.terraform.io/providers/hashicorp/random) for more practical random number use-cases.
58+

docs/index.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
page_title: "Provider: Null"
3+
description: |-
4+
The null provider provides no-op constructs that can be useful helpers in tricky cases.
5+
---
6+
7+
# Null Provider
8+
9+
The `null` provider is a rather-unusual provider that has constructs that
10+
intentionally do nothing. This may sound strange, and indeed these constructs
11+
do not need to be used in most cases, but they can be useful in various
12+
situations to help orchestrate tricky behavior or work around limitations.
13+
14+
The documentation of each feature of this provider, accessible via the
15+
navigation, gives examples of situations where these constructs may prove
16+
useful.
17+
18+
Usage of the `null` provider can make a Terraform configuration harder to
19+
understand. While it can be useful in certain cases, it should be applied with
20+
care and other solutions preferred when available.
21+
22+
<!-- schema generated by tfplugindocs -->
23+
## Schema

docs/resources/resource.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "null_resource Resource - terraform-provider-null"
4+
subcategory: ""
5+
description: |-
6+
The null_resource resource implements the standard resource lifecycle but takes no further action.
7+
The triggers argument allows specifying an arbitrary set of values that, when changed, will cause the resource to be replaced.
8+
---
9+
10+
# null_resource
11+
12+
The `null_resource` resource implements the standard resource lifecycle but takes no further action.
13+
14+
The `triggers` argument allows specifying an arbitrary set of values that, when changed, will cause the resource to be replaced.
15+
16+
## Example Usage
17+
18+
```terraform
19+
resource "aws_instance" "cluster" {
20+
count = 3
21+
22+
# ...
23+
}
24+
25+
# The primary use-case for the null resource is as a do-nothing container for
26+
# arbitrary actions taken by a provisioner.
27+
#
28+
# In this example, three EC2 instances are created and then a null_resource instance
29+
# is used to gather data about all three and execute a single action that affects
30+
# them all. Due to the triggers map, the null_resource will be replaced each time
31+
# the instance ids change, and thus the remote-exec provisioner will be re-run.
32+
resource "null_resource" "cluster" {
33+
# Changes to any instance of the cluster requires re-provisioning
34+
triggers = {
35+
cluster_instance_ids = join(",", aws_instance.cluster.*.id)
36+
}
37+
38+
# Bootstrap script can run on any instance of the cluster
39+
# So we just choose the first in this case
40+
connection {
41+
host = element(aws_instance.cluster.*.public_ip, 0)
42+
}
43+
44+
provisioner "remote-exec" {
45+
# Bootstrap script called with private_ip of each node in the clutser
46+
inline = [
47+
"bootstrap-cluster.sh ${join(" ", aws_instance.cluster.*.private_ip)}",
48+
]
49+
}
50+
}
51+
```
52+
53+
<!-- schema generated by tfplugindocs -->
54+
## Schema
55+
56+
### Optional
57+
58+
- **triggers** (Map of String) A map of arbitrary strings that, when changed, will force the null resource to be replaced, re-running any associated provisioners.
59+
60+
### Read-Only
61+
62+
- **id** (String) This is set to a random value at create time.
63+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
data "null_data_source" "values" {
2+
inputs = {
3+
all_server_ids = concat(aws_instance.green.*.id, aws_instance.blue.*.id)
4+
all_server_ips = concat(aws_instance.green.*.private_ip, aws_instance.blue.*.private_ip)
5+
}
6+
}
7+
8+
resource "aws_elb" "main" {
9+
# ...
10+
11+
instances = data.null_data_source.values.outputs["all_server_ids"]
12+
}
13+
14+
output "all_server_ids" {
15+
value = data.null_data_source.values.outputs["all_server_ids"]
16+
}
17+
18+
output "all_server_ips" {
19+
value = data.null_data_source.values.outputs["all_server_ips"]
20+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
resource "aws_instance" "cluster" {
2+
count = 3
3+
4+
# ...
5+
}
6+
7+
# The primary use-case for the null resource is as a do-nothing container for
8+
# arbitrary actions taken by a provisioner.
9+
#
10+
# In this example, three EC2 instances are created and then a null_resource instance
11+
# is used to gather data about all three and execute a single action that affects
12+
# them all. Due to the triggers map, the null_resource will be replaced each time
13+
# the instance ids change, and thus the remote-exec provisioner will be re-run.
14+
resource "null_resource" "cluster" {
15+
# Changes to any instance of the cluster requires re-provisioning
16+
triggers = {
17+
cluster_instance_ids = join(",", aws_instance.cluster.*.id)
18+
}
19+
20+
# Bootstrap script can run on any instance of the cluster
21+
# So we just choose the first in this case
22+
connection {
23+
host = element(aws_instance.cluster.*.public_ip, 0)
24+
}
25+
26+
provisioner "remote-exec" {
27+
# Bootstrap script called with private_ip of each node in the clutser
28+
inline = [
29+
"bootstrap-cluster.sh ${join(" ", aws_instance.cluster.*.private_ip)}",
30+
]
31+
}
32+
}

go.mod

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
module github.com/terraform-providers/terraform-provider-null
22

3-
require github.com/hashicorp/terraform-plugin-sdk/v2 v2.0.3
3+
require (
4+
github.com/hashicorp/terraform-plugin-docs v0.4.0
5+
github.com/hashicorp/terraform-plugin-sdk/v2 v2.4.2
6+
)
47

58
go 1.15

0 commit comments

Comments
 (0)