docs: Update AWS Data Source docs to have HCL formatted examples (#13467)

* docs: update AWS examples. Disntinguish between alb and alb listener datasource

* more hcl highlighting

* more hcl

* fix missing end quote in docs

* docs: finish updates to AWS data source highlights

Also updates layout to distinguish some resources
This commit is contained in:
Clint 2017-04-07 10:54:28 -05:00 committed by GitHub
parent 1289082c28
commit a3ae38d1bb
43 changed files with 57 additions and 57 deletions

View File

@ -16,7 +16,7 @@ them by domain without having to hard code the ARNs as input.
## Example Usage
```
```hcl
data "aws_acm_certificate" "example" {
domain = "tf.example.com"
statuses = ["ISSUED"]

View File

@ -1,7 +1,7 @@
---
layout: "aws"
page_title: "AWS: aws_alb"
sidebar_current: "docs-aws-datasource-alb"
sidebar_current: "docs-aws-datasource-alb-x"
description: |-
Provides an Application Load Balancer data source.
---
@ -16,7 +16,7 @@ with it, etc.
## Example Usage
```
```hcl
variable "alb_arn" {
type = "string"
default = ""

View File

@ -16,7 +16,7 @@ information specific to the listener in question.
## Example Usage
```
```hcl
variable "listener_arn" {
type = "string"
}

View File

@ -13,7 +13,7 @@ resources.
## Example Usage
```
```hcl
data "aws_ami" "nat_ami" {
most_recent = true
executable_users = ["self"]

View File

@ -13,7 +13,7 @@ ASGs within a specific region. This will allow you to pass a list of AutoScaling
## Example Usage
```
```hcl
data "aws_autoscaling_groups" "groups" {}
resource "aws_autoscaling_notification" "slack_notifications" {

View File

@ -25,7 +25,7 @@ which provides a list of the available zones.
The following example shows how this data source might be used to derive
VPC and subnet CIDR prefixes systematically for an availability zone.
```
```hcl
variable "region_number" {
# Arbitrary mapping of region name to number to use in
# a VPC's CIDR prefix.

View File

@ -17,7 +17,7 @@ which provides some details about a specific availability zone.
## Example Usage
```
```hcl
# Declare the data source
data "aws_availability_zones" "available" {}

View File

@ -14,7 +14,7 @@ which Terraform is authorized.
## Example Usage
```
```hcl
data "aws_caller_identity" "current" {}
output "account_id" {

View File

@ -1,7 +1,7 @@
---
layout: "aws"
page_title: "AWS: aws_canonical_user_id"
sidebar_current: "docs-aws-canonical-user-id"
sidebar_current: "docs-aws-datasource-canonical-user-id"
description: |-
Provides the canonical user ID for the AWS account associated with the provider
connection to AWS.
@ -14,7 +14,7 @@ for the effective account in which Terraform is working.
## Example Usage
```
```hcl
data "aws_canonical_user_id" "current" {}
output "canonical_user_id" {

View File

@ -13,7 +13,7 @@ outputs and other useful data including the template body.
## Example Usage
```
```hcl
data "aws_cloudformation_stack" "network" {
name = "my-network-stack"
}

View File

@ -12,7 +12,7 @@ Use this data source to get information about an RDS instance
## Example Usage
```
```hcl
data "aws_db_instance" "database" {
db_instance_identifier = "my-test-database"
}

View File

@ -12,7 +12,7 @@ Use this data source to get information about an EBS Snapshot for use when provi
## Example Usage
```
```hcl
data "aws_ebs_snapshot" "ebs_volume" {
most_recent = true
owners = ["self"]

View File

@ -13,7 +13,7 @@ resources.
## Example Usage
```
```hcl
data "aws_ebs_volume" "ebs_volume" {
most_recent = true

View File

@ -13,7 +13,7 @@ cluster within an AWS ECS service.
## Example Usage
```
```hcl
data "aws_ecs_cluster" "ecs-mongo" {
cluster_name = "ecs-mongo-production"
}

View File

@ -13,7 +13,7 @@ a specific container within an AWS ECS service.
## Example Usage
```
```hcl
data "aws_ecs_container_definition" "ecs-mongo" {
task_definition = "${aws_ecs_task_definition.mongo.id}"
container_name = "mongodb"

View File

@ -14,7 +14,7 @@ a specific AWS ECS task definition.
## Example Usage
```
```hcl
# Simply specify the family to find the latest ACTIVE revision in that family.
data "aws_ecs_task_definition" "mongo" {
task_definition = "${aws_ecs_task_definition.mongo.family}"

View File

@ -13,7 +13,7 @@ in a given region for the purpose of using in an AWS Route53 Alias.
## Example Usage
```
```hcl
data "aws_elb_hosted_zone_id" "main" {}
resource "aws_route53_record" "www" {

View File

@ -13,7 +13,7 @@ in a given region for the purpose of whitelisting in S3 bucket policy.
## Example Usage
```
```hcl
data "aws_elb_service_account" "main" {}
resource "aws_s3_bucket" "elb_logs" {

View File

@ -14,7 +14,7 @@ for the effective account in which Terraform is working.
## Example Usage
```
```hcl
data "aws_iam_account_alias" "current" {}
output "account_id" {

View File

@ -14,7 +14,7 @@ This is a data source which can be used to construct a JSON representation of
an IAM policy document, for use with resources which expect policy documents,
such as the `aws_iam_policy` resource.
```
```hcl
data "aws_iam_policy_document" "example" {
statement {
sid = "1"
@ -149,7 +149,7 @@ The following attribute is exported:
Showing how you can use this as an assume role policy as well as showing how you can specify multiple principal blocks with different types.
```
```hcl
data "aws_iam_policy_document" "event_stream_bucket_role_assume_role_policy" {
statement {
actions = ["sts:AssumeRole"]

View File

@ -1,6 +1,6 @@
---
layout: "aws"
page_title: "AWS: aws_iam_role
page_title: "AWS: aws_iam_role"
sidebar_current: "docs-aws-datasource-iam-role"
description: |-
Get information on a Amazon IAM role
@ -14,7 +14,7 @@ properties without having to hard code ARNs as input.
## Example Usage
```
```hcl
data "aws_iam_role" "example" {
role_name = "an_example_role_name"
}

View File

@ -12,7 +12,7 @@ Use this data source to lookup information about IAM Server Certificates.
## Example Usage
```
```hcl
data "aws_iam_server_certificate" "my-domain" {
name_prefix = "my-domain.org"
latest = true

View File

@ -13,7 +13,7 @@ resources.
## Example Usage
```
```hcl
data "aws_instance" "foo" {
instance_id = "i-instanceid"

View File

@ -12,7 +12,7 @@ Use this data source to get the [IP ranges][1] of various AWS products and servi
## Example Usage
```
```hcl
data "aws_ip_ranges" "european_ec2" {
regions = ["eu-west-1", "eu-central-1"]
services = ["ec2"]

View File

@ -36,7 +36,7 @@ AQECAHgaPa0J8WadplGCqqVAr4HNvDaFSQ+NaiwIBhmm6qDSFwAAAGIwYAYJKoZIhvcNAQcGoFMwUQIB
Now, take that output and add it to your resource definitions.
```
```hcl
data "aws_kms_secret" "db" {
secret {
name = "master_password"

View File

@ -12,7 +12,7 @@ Use this data source to lookup current AWS partition in which Terraform is worki
## Example Usage
```
```hcl
data "aws_partition" "current" {}
data "aws_iam_policy_document" "s3_policy" {

View File

@ -18,7 +18,7 @@ rules.
## Example Usage
```
```hcl
resource "aws_vpc_endpoint" "private_s3" {
vpc_id = "${aws_vpc.foo.id}"
service_name = "com.amazonaws.us-west-2.s3"

View File

@ -13,7 +13,7 @@ in a given region for the purpose of allowing Redshift to store audit data in S3
## Example Usage
```
```hcl
data "aws_redshift_service_account" "main" {}
resource "aws_s3_bucket" "bucket" {

View File

@ -20,7 +20,7 @@ which is inheriting an AWS provider configuration from its parent module.
The following example shows how the resource might be used to obtain
the name of the AWS region configured on the provider.
```
```hcl
data "aws_region" "current" {
current = true
}

View File

@ -17,7 +17,7 @@ This data source allows to find a Hosted Zone ID given Hosted Zone name and cert
The following example shows how to get a Hosted Zone from it's name and from this data how to create a Record Set.
```
```hcl
data "aws_route53_zone" "selected" {
name = "test.com."
private_zone = true

View File

@ -19,7 +19,7 @@ the Route Table.
The following example shows how one might accept a Route Table id as a variable
and use this data source to obtain the data necessary to create a route.
```
```hcl
variable "subnet_id" {}
data "aws_route_table" "selected" {

View File

@ -15,7 +15,7 @@ _optionally_ (see below) content of an object stored inside S3 bucket.
## Example Usage
```
```hcl
data "aws_s3_bucket_object" "lambda" {
bucket = "my-lambda-functions"
key = "hello-world.zip"

View File

@ -19,7 +19,7 @@ VPC that the security group belongs to.
The following example shows how one might accept a Security Group id as a variable
and use this data source to obtain the data necessary to create a subnet.
```
```hcl
variable "security_group_id" {}
data "aws_security_group" "selected" {

View File

@ -14,7 +14,7 @@ without having to hard code the ARNs as input.
## Example Usage
```
```hcl
data "aws_sns_topic" "example" {
name = "an_example_topic"
}

View File

@ -1,7 +1,7 @@
---
layout: "aws"
page_title: "AWS: aws_subnet"
sidebar_current: "docs-aws-datasource-subnet"
sidebar_current: "docs-aws-datasource-subnet-x"
description: |-
Provides details about a specific VPC subnet
---
@ -20,7 +20,7 @@ The following example shows how one might accept a subnet id as a variable
and use this data source to obtain the data necessary to create a security
group that allows connections from hosts in that subnet.
```
```hcl
variable "subnet_id" {}
data "aws_subnet" "selected" {

View File

@ -16,7 +16,7 @@ This resource can be useful for getting back a list of subnet ids for a vpc.
The following shows outputing all cidr blocks for every subnet id in a vpc.
```
```hcl
data "aws_subnet_ids" "example" {
vpc_id = "${var.vpc_id}"
}

View File

@ -1,7 +1,7 @@
---
layout: "aws"
page_title: "AWS: aws_vpc"
sidebar_current: "docs-aws-datasource-vpc"
sidebar_current: "docs-aws-datasource-vpc-x"
description: |-
Provides details about a specific VPC
---
@ -20,7 +20,7 @@ The following example shows how one might accept a VPC id as a variable
and use this data source to obtain the data necessary to create a subnet
within it.
```
```hcl
variable "vpc_id" {}
data "aws_vpc" "selected" {

View File

@ -1,7 +1,7 @@
---
layout: "aws"
page_title: "AWS: aws_vpc_endpoint"
sidebar_current: "docs-aws-datasource-vpc-endpoint"
sidebar_current: "docs-aws-datasource-vpc-endpoint-x"
description: |-
Provides details about a specific VPC endpoint.
---
@ -13,7 +13,7 @@ a specific VPC endpoint.
## Example Usage
```
```hcl
# Declare the data source
data "aws_vpc_endpoint" "s3" {
vpc_id = "${aws_vpc.foo.id}"

View File

@ -14,7 +14,7 @@ configured in the provider.
## Example Usage
```
```hcl
# Declare the data source
data "aws_vpc_endpoint_service" "s3" {
service = "s3"

View File

@ -13,7 +13,7 @@ a specific VPC peering connection.
## Example Usage
```
```hcl
# Declare the data source
data "aws_vpc_peering_connection" "pc" {
vpc_id = "${aws_vpc.foo.id}"

View File

@ -13,7 +13,7 @@ a specific VPN gateway.
## Example Usage
```
```hcl
data "aws_vpn_gateway" "selected" {
filter {
name = "tag:Name"

View File

@ -16,7 +16,7 @@ Use the navigation to the left to read about the available resources.
## Example Usage
```
```hcl
# Configure the AWS Provider
provider "aws" {
access_key = "${var.aws_access_key}"
@ -64,13 +64,13 @@ Access Key and AWS Secret Key, respectively. The `AWS_DEFAULT_REGION`
and `AWS_SESSION_TOKEN` environment variables are also used, if
applicable:
```
```hcl
provider "aws" {}
```
Usage:
```
```hcl
$ export AWS_ACCESS_KEY_ID="anaccesskey"
$ export AWS_SECRET_ACCESS_KEY="asecretkey"
$ export AWS_DEFAULT_REGION="us-west-2"
@ -91,7 +91,7 @@ method also supports a `profile` configuration and matching
Usage:
```
```hcl
provider "aws" {
region = "us-west-2"
shared_credentials_file = "/Users/tf_user/.aws/creds"
@ -120,7 +120,7 @@ using the supplied credentials.
Usage:
```
```hcl
provider "aws" {
assume_role {
role_arn = "arn:aws:iam::ACCOUNT_ID:role/ROLE_NAME"

View File

@ -17,7 +17,7 @@
<li<%= sidebar_current("docs-aws-datasource-acm-certificate") %>>
<a href="/docs/providers/aws/d/acm_certificate.html">aws_acm_certificate</a>
</li>
<li<%= sidebar_current("docs-aws-datasource-alb") %>>
<li<%= sidebar_current("docs-aws-datasource-alb-x") %>>
<a href="/docs/providers/aws/d/alb.html">aws_alb</a>
</li>
<li<%= sidebar_current("docs-aws-datasource-alb-listener") %>>
@ -116,16 +116,16 @@
<li<%= sidebar_current("docs-aws-datasource-sns-topic") %>>
<a href="/docs/providers/aws/d/sns_topic.html">aws_sns_topic</a>
</li>
<li<%= sidebar_current("docs-aws-datasource-subnet") %>>
<li<%= sidebar_current("docs-aws-datasource-subnet-x") %>>
<a href="/docs/providers/aws/d/subnet.html">aws_subnet</a>
</li>
<li<%= sidebar_current("docs-aws-datasource-subnet-ids") %>>
<a href="/docs/providers/aws/d/subnet_ids.html">aws_subnet_ids</a>
</li>
<li<%= sidebar_current("docs-aws-datasource-vpc") %>>
<li<%= sidebar_current("docs-aws-datasource-vpc-x") %>>
<a href="/docs/providers/aws/d/vpc.html">aws_vpc</a>
</li>
<li<%= sidebar_current("docs-aws-datasource-vpc-endpoint") %>>
<li<%= sidebar_current("docs-aws-datasource-vpc-endpoint-x") %>>
<a href="/docs/providers/aws/d/vpc_endpoint.html">aws_vpc_endpoint</a>
</li>
<li<%= sidebar_current("docs-aws-datasource-vpc-endpoint-service") %>>