Skip to content

Commit

Permalink
Merge pull request #6372 from terraform-providers/d-format_doc_examples
Browse files Browse the repository at this point in the history
D format doc examples
  • Loading branch information
tracypholmes authored Nov 7, 2018
2 parents f48859d + 23199dc commit 8985d91
Show file tree
Hide file tree
Showing 215 changed files with 910 additions and 814 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ website/vendor

# Keep windows files with windows line endings
*.winfile eol=crlf
/.vs
/.vs
node_modules
3 changes: 3 additions & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ fmt:
fmtcheck:
@sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'"

websitefmtcheck:
@sh -c "'$(CURDIR)/scripts/websitefmtcheck.sh'"

lint:
@echo "==> Checking source code against linters..."
@gometalinter ./$(PKG_NAME)
Expand Down
9 changes: 5 additions & 4 deletions examples/cloudhsm/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,20 @@ resource "aws_subnet" "cloudhsm2_subnets" {
}

resource "aws_cloudhsm_v2_cluster" "cloudhsm_v2_cluster" {
hsm_type = "hsm1.medium"
hsm_type = "hsm1.medium"
subnet_ids = ["${aws_subnet.cloudhsm2_subnets.*.id}"]

tags {
Name = "example-aws_cloudhsm_v2_cluster"
}
}

resource "aws_cloudhsm_v2_hsm" "cloudhsm_v2_hsm" {
subnet_id = "${aws_subnet.cloudhsm2_subnets.0.id}"
subnet_id = "${aws_subnet.cloudhsm2_subnets.0.id}"
cluster_id = "${aws_cloudhsm_v2_cluster.cloudhsm_v2_cluster.cluster_id}"
}

data "aws_cloudhsm_v2_cluster" "cluster" {
cluster_id = "${aws_cloudhsm_v2_cluster.cloudhsm_v2_cluster.cluster_id}"
depends_on = ["aws_cloudhsm_v2_hsm.cloudhsm_v2_hsm"]
cluster_id = "${aws_cloudhsm_v2_cluster.cloudhsm_v2_cluster.cluster_id}"
depends_on = ["aws_cloudhsm_v2_hsm.cloudhsm_v2_hsm"]
}
4 changes: 2 additions & 2 deletions examples/cloudhsm/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
output "hsm_ip_address" {
value = "${aws_cloudhsm_v2_hsm.cloudhsm_v2_hsm.ip_address}"
value = "${aws_cloudhsm_v2_hsm.cloudhsm_v2_hsm.ip_address}"
}

output "cluster_data_certificate" {
value = "${data.aws_cloudhsm_v2_cluster.cluster.cluster_certificates.0.cluster_csr}"
value = "${data.aws_cloudhsm_v2_cluster.cluster.cluster_certificates.0.cluster_csr}"
}
19 changes: 19 additions & 0 deletions scripts/websitefmtcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

set -eou pipefail

npm list codedown > /dev/null 2>&1 || npm install --no-save codedown > /dev/null 2>&1

problems=false
for f in $(find website -name '*.markdown'); do
if [ "${1-}" = "diff" ]; then
echo "$f"
cat "$f" | node_modules/.bin/codedown hcl | terraform fmt -diff=true -
else
cat "$f" | node_modules/.bin/codedown hcl | terraform fmt -check=true - || problems=true && echo "Formatting errors in $f"
fi
done

if [ "$problems" = true ] ; then
exit 1
fi
4 changes: 2 additions & 2 deletions website/docs/d/acm_certificate.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ data "aws_acm_certificate" "example" {
}
data "aws_acm_certificate" "example" {
domain = "tf.example.com"
types = ["AMAZON_ISSUED"]
domain = "tf.example.com"
types = ["AMAZON_ISSUED"]
most_recent = true
}
```
Expand Down
4 changes: 2 additions & 2 deletions website/docs/d/autoscaling_groups.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ ASGs within a specific region. This will allow you to pass a list of AutoScaling
```hcl
data "aws_autoscaling_groups" "groups" {
filter {
name = "key"
name = "key"
values = ["Team"]
}
filter {
name = "value"
name = "value"
values = ["Pets"]
}
}
Expand Down
4 changes: 2 additions & 2 deletions website/docs/d/cloudhsm_v2_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Use this data source to get information about a CloudHSM v2 cluster

```hcl
data "aws_cloudhsm_v2_cluster" "cluster" {
cluster_id = "cluster-testclusterid"
cluster_id = "cluster-testclusterid"
}
```
## Argument Reference
Expand All @@ -37,4 +37,4 @@ The following attributes are exported:
* `cluster_certificates.0.aws_hardware_certificate` - The HSM hardware certificate issued (signed) by AWS CloudHSM.
* `cluster_certificates.0.hsm_certificate` - The HSM certificate issued (signed) by the HSM hardware.
* `cluster_certificates.0.manufacturer_hardware_certificate` - The HSM hardware certificate issued (signed) by the hardware manufacturer.
The number of available cluster certificates may vary depending on state of the cluster.
The number of available cluster certificates may vary depending on state of the cluster.
2 changes: 1 addition & 1 deletion website/docs/d/codecommit_repository.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ In addition to all arguments above, the following attributes are exported:
* `repository_id` - The ID of the repository
* `arn` - The ARN of the repository
* `clone_url_http` - The URL to use for cloning the repository over HTTPS.
* `clone_url_ssh` - The URL to use for cloning the repository over SSH.
* `clone_url_ssh` - The URL to use for cloning the repository over SSH.
6 changes: 3 additions & 3 deletions website/docs/d/cognito_user_pools.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ data "aws_cognito_user_pools" "selected" {
}
resource "aws_api_gateway_authorizer" "cognito" {
name = "cognito"
type = "COGNITO_USER_POOLS"
rest_api_id = "${data.aws_api_gateway_rest_api.selected.id}"
name = "cognito"
type = "COGNITO_USER_POOLS"
rest_api_id = "${data.aws_api_gateway_rest_api.selected.id}"
provider_arns = ["${data.aws_cognito_user_pools.selected.arns}"]
}
```
Expand Down
11 changes: 5 additions & 6 deletions website/docs/d/db_cluster_snapshot.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ See the [`aws_db_snapshot` data source](/docs/providers/aws/d/db_snapshot.html)
```hcl
data "aws_db_cluster_snapshot" "development_final_snapshot" {
db_cluster_identifier = "development_cluster"
most_recent = true
most_recent = true
}
# Use the last snapshot of the dev database before it was destroyed to create
# a new dev database.
resource "aws_rds_cluster" "aurora" {
cluster_identifier = "development_cluster"
snapshot_identifier = "${aws_db_cluster_snapshot.development_final_snapshot.id}"
cluster_identifier = "development_cluster"
snapshot_identifier = "${aws_db_cluster_snapshot.development_final_snapshot.id}"
db_subnet_group_name = "my_db_subnet_group"
lifecycle {
Expand All @@ -34,11 +34,10 @@ resource "aws_rds_cluster" "aurora" {
}
resource "aws_rds_cluster_instance" "aurora" {
cluster_identifier = "${aws_rds_cluster.aurora.id}"
instance_class = "db.t2.small"
cluster_identifier = "${aws_rds_cluster.aurora.id}"
instance_class = "db.t2.small"
db_subnet_group_name = "my_db_subnet_group"
}
```

## Argument Reference
Expand Down
3 changes: 2 additions & 1 deletion website/docs/d/db_snapshot.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ resource "aws_db_instance" "prod" {
data "aws_db_snapshot" "latest_prod_snapshot" {
db_instance_identifier = "${aws_db_instance.prod.id}"
most_recent = true
most_recent = true
}
# Use the latest production snapshot to create a dev instance.
resource "aws_db_instance" "dev" {
instance_class = "db.t2.micro"
name = "mydbdev"
snapshot_identifier = "${data.aws_db_snapshot.latest_prod_snapshot.id}"
lifecycle {
ignore_changes = ["snapshot_identifier"]
}
Expand Down
2 changes: 1 addition & 1 deletion website/docs/d/dynamodb_table.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ The following arguments are supported:
## Attributes Reference

See the [DynamoDB Table Resource](/docs/providers/aws/r/dynamodb_table.html) for details on the
returned attributes - they are identical.
returned attributes - they are identical.
2 changes: 1 addition & 1 deletion website/docs/d/efs_file_system.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Provides information about an Elastic File System (EFS).

```hcl
variable "file_system_id" {
type = "string"
type = "string"
default = ""
}
Expand Down
2 changes: 1 addition & 1 deletion website/docs/d/efs_mount_target.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Provides information about an Elastic File System Mount Target (EFS).

```hcl
variable "mount_target_id" {
type = "string"
type = "string"
default = ""
}
Expand Down
2 changes: 1 addition & 1 deletion website/docs/d/eks_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Retrieve information about an EKS Cluster.

```hcl
data "aws_eks_cluster" "example" {
name = "example"
name = "example"
}
output "endpoint" {
Expand Down
4 changes: 2 additions & 2 deletions website/docs/d/elastic_beanstalk_solution_stack.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ Use this data source to get the name of a elastic beanstalk solution stack.

```hcl
data "aws_elastic_beanstalk_solution_stack" "multi_docker" {
most_recent = true
most_recent = true
name_regex = "^64bit Amazon Linux (.*) Multi-container Docker (.*)$"
name_regex = "^64bit Amazon Linux (.*) Multi-container Docker (.*)$"
}
```

Expand Down
6 changes: 3 additions & 3 deletions website/docs/d/iam_policy_document.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -307,22 +307,22 @@ Use without a `statement`:
```hcl
data "aws_iam_policy_document" "source" {
statement {
sid = "OverridePlaceholder"
sid = "OverridePlaceholder"
actions = ["ec2:DescribeAccountAttributes"]
resources = ["*"]
}
}
data "aws_iam_policy_document" "override" {
statement {
sid = "OverridePlaceholder"
sid = "OverridePlaceholder"
actions = ["s3:GetObject"]
resources = ["*"]
}
}
data "aws_iam_policy_document" "politik" {
source_json = "${data.aws_iam_policy_document.source.json}"
source_json = "${data.aws_iam_policy_document.source.json}"
override_json = "${data.aws_iam_policy_document.override.json}"
}
```
Expand Down
2 changes: 1 addition & 1 deletion website/docs/d/inspector_rules_packages.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ data "aws_inspector_rules_packages" "rules" {}
# e.g. Use in aws_inspector_assessment_template
resource "aws_inspector_resource_group" "group" {
tags {
test = "test"
test = "test"
}
}
Expand Down
7 changes: 4 additions & 3 deletions website/docs/d/instances.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,17 @@ data "aws_instances" "test" {
instance_tags {
Role = "HardWorker"
}
filter {
name = "instance.group-id"
values = ["sg-12345678"]
}
instance_state_names = [ "running", "stopped" ]
instance_state_names = ["running", "stopped"]
}
resource "aws_eip" "test" {
count = "${length(data.aws_instances.test.ids)}"
count = "${length(data.aws_instances.test.ids)}"
instance = "${data.aws_instances.test.ids[count.index]}"
}
```
Expand Down
2 changes: 1 addition & 1 deletion website/docs/d/internet_gateway.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ variable "vpc_id" {}
data "aws_internet_gateway" "default" {
filter {
name = "attachment.vpc-id"
name = "attachment.vpc-id"
values = ["${var.vpc_id}"]
}
}
Expand Down
1 change: 1 addition & 0 deletions website/docs/d/iot_endpoint.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ resource "kubernetes_pod" "agent" {
metadata {
name = "my-device"
}
spec {
container {
image = "gcr.io/my-project/image-name"
Expand Down
3 changes: 2 additions & 1 deletion website/docs/d/kms_ciphertext.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ by using an AWS KMS customer master key.
```hcl
resource "aws_kms_key" "oauth_config" {
description = "oauth config"
is_enabled = true
is_enabled = true
}
data "aws_kms_ciphertext" "oauth" {
key_id = "${aws_kms_key.oauth_config.key_id}"
plaintext = <<EOF
{
"client_id": "e587dbae22222f55da22",
Expand Down
2 changes: 1 addition & 1 deletion website/docs/d/kms_key.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ data "aws_kms_key" "foo" {
* `key_state`: The state of the key
* `key_usage`: Currently the only allowed value is `ENCRYPT_DECRYPT`
* `origin`: When this value is `AWS_KMS`, AWS KMS created the key material. When this value is `EXTERNAL`, the key material was imported from your existing key management infrastructure or the CMK lacks key material
* `valid_to`: The time at which the imported key material expires. This value is present only when `origin` is `EXTERNAL` and whose `expiration_model` is `KEY_MATERIAL_EXPIRES`, otherwise this value is 0
* `valid_to`: The time at which the imported key material expires. This value is present only when `origin` is `EXTERNAL` and whose `expiration_model` is `KEY_MATERIAL_EXPIRES`, otherwise this value is 0
4 changes: 1 addition & 3 deletions website/docs/d/kms_secrets.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ data "aws_kms_secrets" "example" {
secret {
# ... potentially other configuration ...
name = "master_username"
payload = "AQECAHgaPa0J8WadplGCqqVAr4HNvDaFSQ+NaiwIBhmm6qDSFwAAAGIwYAYJKoZI
hvcNAQcGoFMwUQIBADBMBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDI+LoLdvYv8l41OhAAIBEIAf
x49FFJCLeYrkfMfAw6XlnxP23MmDBdqP8dPp28OoAQ=="
payload =  "AQECAHgaPa0J8WadplGCqqVAr4HNvDaFSQNaiwIBhmm6qDSFwAAAGIwYAYJKoZIhvcNAQcGoFMwUQIBADBMBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDILoLdvYv8l41OhAAIBEIAfx49FFJCLeYrkfMfAw6XlnxP23MmDBdqP8dPp28OoAQ=="
}
}
Expand Down
1 change: 0 additions & 1 deletion website/docs/d/lambda_invocation.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ data "aws_lambda_invocation" "example" {
"key2": "value2"
}
JSON
}
output "result_entry" {
Expand Down
2 changes: 1 addition & 1 deletion website/docs/d/lb_listener.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ data "aws_lb" "selected" {
data "aws_lb_listener" "selected443" {
load_balancer_arn = "${data.aws_lb.selected.arn}"
port = 443
port = 443
}
```

Expand Down
4 changes: 3 additions & 1 deletion website/docs/d/network_acls.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ tag of `Tier` set to a value of "Private".
```hcl
data "aws_network_acls" "example" {
vpc_id = "${var.vpc_id}"
tags {
Tier = "Private"
}
Expand All @@ -40,8 +41,9 @@ with specific subnet.
```hcl
data "aws_network_acls" "example" {
vpc_id = "${var.vpc_id}"
filter {
name = "association.subnet-id"
name = "association.subnet-id"
values = ["${aws_subnet.test.id}"]
}
}
Expand Down
2 changes: 1 addition & 1 deletion website/docs/d/network_interfaces.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ with specific subnet.
```hcl
data "aws_network_interfaces" "example" {
filter {
name = "subnet-id"
name = "subnet-id"
values = ["${aws_subnet.test.id}"]
}
}
Expand Down
Loading

0 comments on commit 8985d91

Please sign in to comment.