website/docs: Run `terraform fmt` on code examples (#12075)

* docs/vsphere: Fix code block

* docs: Convert `...` to `# ...` to allow `terraform fmt`ing

* docs: Trim trailing whitespace

* docs: First-pass run of `terraform fmt` on code examples
This commit is contained in:
George Christou 2017-02-18 22:48:50 +00:00 committed by Paul Stack
parent 1196114433
commit 61277c0dbd
619 changed files with 5178 additions and 4867 deletions

View File

@ -71,7 +71,7 @@ In these cases, you can't use a relative path, since paths in Terraform are gene
```
resource "aws_instance" "server" {
...
# ...
provisioner "remote-exec" {
script = "${path.module}/script.sh"

View File

@ -17,7 +17,6 @@ data "alicloud_images" "multi_image" {
owners = "system"
name_regex = "^centos_6"
}
```
## Argument Reference

View File

@ -26,7 +26,6 @@ resource "alicloud_instance" "instance" {
# Other properties...
}
```
## Argument Reference

View File

@ -16,7 +16,6 @@ The Regions data source allows access to the list of Alicloud Regions.
data "alicloud_regions" "current" {
current = true
}
```
## Argument Reference

View File

@ -26,7 +26,6 @@ resource "alicloud_instance" "instance" {
# Other properties...
}
```
## Argument Reference

View File

@ -15,8 +15,8 @@ Provides a ECS EIP resource.
```
# Create a new EIP.
resource "alicloud_eip" "example" {
bandwidth "10"
internet_charge_type "PayByBandwidth"
bandwidth = "10"
internet_charge_type = "PayByBandwidth"
}
```
## Argument Reference

View File

@ -27,8 +27,10 @@ resource "alicloud_vswitch" "vsw" {
vpc_id = "${alicloud_vpc.vpc.id}"
cidr_block = "10.1.1.0/24"
availability_zone = "cn-beijing-a"
depends_on = [
"alicloud_vpc.vpc"]
"alicloud_vpc.vpc",
]
}
resource "alicloud_instance" "ecs_instance" {
@ -45,8 +47,7 @@ resource "alicloud_instance" "ecs_instance" {
}
}
resource "alicloud_eip" "eip" {
}
resource "alicloud_eip" "eip" {}
resource "alicloud_eip_association" "eip_asso" {
allocation_id = "${alicloud_eip.eip.id}"

View File

@ -30,17 +30,22 @@ resource "alicloud_nat_gateway" "nat_gateway" {
vpc_id = "${alicloud_vpc.vpc.id}"
spec = "Small"
name = "test_foo"
bandwidth_packages = [{
ip_count = 1
bandwidth = 5
zone = "cn-beijing-b"
}, {
},
{
ip_count = 2
bandwidth = 10
zone = "cn-beijing-b"
}]
},
]
depends_on = [
"alicloud_vswitch.vsw"]
"alicloud_vswitch.vsw",
]
}
```

View File

@ -30,7 +30,7 @@ resource "alicloud_security_group_rule" "allow_all_tcp" {
policy = "accept"
port_range = "1/65535"
priority = 1
security_group_id = "${alicloud_security_group.default.id}"ecs.InstanceAttributesType
security_group_id = "${alicloud_security_group.default.id}"
cidr_ip = "0.0.0.0/0"
}
```

View File

@ -19,23 +19,27 @@ resource "alicloud_slb" "classic" {
internet = true
internet_charge_type = "paybybandwidth"
bandwidth = 5
listener = [
{
"instance_port" = "2111"
"lb_port" = "21"
"lb_protocol" = "tcp"
"bandwidth" = "5"
},{
},
{
"instance_port" = "8000"
"lb_port" = "80"
"lb_protocol" = "http"
"bandwidth" = "5"
},{
},
{
"instance_port" = "1611"
"lb_port" = "161"
"lb_protocol" = "udp"
"bandwidth" = "5"
}]
},
]
}
# Create a new load balancer for VPC

View File

@ -26,7 +26,6 @@ resource "alicloud_slb_attachment" "default" {
slb_id = "${alicloud_slb.default.id}"
instances = ["${alicloud_instance.default.id}"]
}
```
## Argument Reference

View File

@ -15,6 +15,5 @@ Use the navigation to the left to read about the available resources.
## Example Usage
```
provider "archive" {
}
provider "archive" {}
```

View File

@ -37,10 +37,12 @@ resource "arukas_container" "foobar" {
image = "nginx:latest"
instances = 1
memory = 256
ports = {
protocol = "tcp"
number = "80"
}
environments {
key = "key1"
value = "value1"

View File

@ -22,10 +22,12 @@ resource "arukas_container" "foobar" {
image = "nginx:latest"
instances = 1
memory = 256
ports = {
protocol = "tcp"
number = "80"
}
environments {
key = "key1"
value = "value1"

View File

@ -26,6 +26,7 @@ data "atlas_artifact" "web" {
name = "hashicorp/web"
type = "amazon.image"
build = "latest"
metadata {
arch = "386"
}
@ -35,7 +36,8 @@ data "atlas_artifact" "web" {
# Remember to include the AWS region as it is part of the full ID
resource "aws_instance" "app" {
ami = "${data.atlas_artifact.web.metadata_full.region-us-east-1}"
...
# ...
}
```

View File

@ -26,7 +26,7 @@ provider "atlas" {
# Fetch an artifact configuration
data "atlas_artifact" "web" {
...
# ...
}
```

View File

@ -29,6 +29,7 @@ resource "atlas_artifact" "web" {
name = "hashicorp/web"
type = "amazon.image"
build = "latest"
metadata {
arch = "386"
}
@ -38,7 +39,8 @@ resource "atlas_artifact" "web" {
# Remember to include the AWS region as it is part of the full ID
resource "aws_instance" "app" {
ami = "${atlas_artifact.web.metadata_full.region-us-east-1}"
...
# ...
}
```

View File

@ -17,14 +17,17 @@ resources.
data "aws_ami" "nat_ami" {
most_recent = true
executable_users = ["self"]
filter {
name = "owner-alias"
values = ["amazon"]
}
filter {
name = "name"
values = ["amzn-ami-vpc-nat*"]
}
name_regex = "^myami-\\d{3}"
owners = ["self"]
}

View File

@ -18,12 +18,14 @@ data "aws_autoscaling_groups" "groups" {}
resource "aws_autoscaling_notification" "slack_notifications" {
group_names = ["${data.aws_autoscaling_groups.groups.names}"]
notifications = [
"autoscaling:EC2_INSTANCE_LAUNCH",
"autoscaling:EC2_INSTANCE_TERMINATE",
"autoscaling:EC2_INSTANCE_LAUNCH_ERROR",
"autoscaling:EC2_INSTANCE_TERMINATE_ERROR"
"autoscaling:EC2_INSTANCE_TERMINATE_ERROR",
]
topic_arn = "TOPIC ARN"
}
```

View File

@ -18,6 +18,7 @@ data "aws_billing_service_account" "main" { }
resource "aws_s3_bucket" "billing_logs" {
bucket = "my-billing-tf-test-bucket"
acl = "private"
policy = <<POLICY
{
"Id": "Policy",

View File

@ -22,6 +22,7 @@ resource "aws_instance" "web" {
ami = "ami-abb07bcb"
instance_type = "t1.micro"
subnet_id = "${data.aws_cloudformation_stack.network.outputs["SubnetId"]}"
tags {
Name = "HelloWorld"
}

View File

@ -16,10 +16,12 @@ Use this data source to get information about an EBS Snapshot for use when provi
data "aws_ebs_snapshot" "ebs_volume" {
most_recent = true
owners = ["self"]
filter {
name = "volume-size"
values = ["40"]
}
filter {
name = "tag:Name"
values = ["Example"]

View File

@ -16,10 +16,12 @@ resources.
```
data "aws_ebs_volume" "ebs_volume" {
most_recent = true
filter {
name = "volume-type"
values = ["gp2"]
}
filter {
name = "tag:Name"
values = ["Example"]

View File

@ -26,6 +26,7 @@ resource "aws_ecs_cluster" "foo" {
resource "aws_ecs_task_definition" "mongo" {
family = "mongodb"
container_definitions = <<DEFINITION
[
{

View File

@ -19,6 +19,7 @@ data "aws_elb_service_account" "main" { }
resource "aws_s3_bucket" "elb_logs" {
bucket = "my-elb-tf-test-bucket"
acl = "private"
policy = <<POLICY
{
"Id": "Policy",

View File

@ -18,10 +18,12 @@ such as the `aws_iam_policy` resource.
data "aws_iam_policy_document" "example" {
statement {
sid = "1"
actions = [
"s3:ListAllMyBuckets",
"s3:GetBucketLocation",
]
resources = [
"arn:aws:s3:::*",
]
@ -31,12 +33,15 @@ data "aws_iam_policy_document" "example" {
actions = [
"s3:ListBucket",
]
resources = [
"arn:aws:s3:::${var.s3_bucket_name}",
]
condition {
test = "StringLike"
variable = "s3:prefix"
values = [
"",
"home/",
@ -49,12 +54,12 @@ data "aws_iam_policy_document" "example" {
actions = [
"s3:*",
]
resources = [
"arn:aws:s3:::${var.s3_bucket_name}/home/&{aws:username}",
"arn:aws:s3:::${var.s3_bucket_name}/home/&{aws:username}/*",
]
}
}
resource "aws_iam_policy" "example" {

View File

@ -21,7 +21,6 @@ data "aws_iam_server_certificate" "my-domain" {
resource "aws_elb" "elb" {
name = "my-domain-elb"
listener {
instance_port = 8000
instance_protocol = "https"

View File

@ -16,10 +16,12 @@ resources.
```
data "aws_instance" "foo" {
instance_id = "i-instanceid"
filter {
name = "image-id"
values = ["ami-xxxxxxxx"]
}
filter {
name = "tag:Name"
values = ["instance-name-tag"]

View File

@ -19,7 +19,6 @@ data "aws_ip_ranges" "european_ec2" {
}
resource "aws_security_group" "from_europe" {
name = "from_europe"
ingress {
@ -33,7 +32,6 @@ resource "aws_security_group" "from_europe" {
CreateDate = "${data.aws_ip_ranges.european_ec2.create_date}"
SyncToken = "${data.aws_ip_ranges.european_ec2.sync_token}"
}
}
```

View File

@ -51,7 +51,8 @@ data "aws_kms_secret" "db" {
resource "aws_rds_cluster" "rds" {
master_username = "root"
master_password = "${data.aws_kms_secret.db.master_password}"
...
# ...
}
```

View File

@ -28,7 +28,6 @@ data "aws_iam_policy_document" "s3_policy" {
]
}
}
```
## Argument Reference

View File

@ -31,6 +31,7 @@ data "aws_prefix_list" "private_s3" {
resource "aws_network_acl" "bar" {
vpc_id = "${aws_vpc.foo.id}"
}
resource "aws_network_acl_rule" "private_s3" {
network_acl_id = "${aws_network_acl.bar.id}"
rule_number = 200

View File

@ -19,6 +19,7 @@ data "aws_redshift_service_account" "main" { }
resource "aws_s3_bucket" "bucket" {
bucket = "tf-redshift-logging-test-bucket"
force_destroy = true
policy = <<EOF
{
"Version": "2008-10-17",

View File

@ -23,6 +23,7 @@ data "aws_s3_bucket_object" "lambda" {
resource "aws_iam_role" "iam_for_lambda" {
name = "iam_for_lambda"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",

View File

@ -26,7 +26,7 @@ provider "aws" {
# Create a web server
resource "aws_instance" "web" {
...
# ...
}
```

View File

@ -28,6 +28,7 @@ resource "aws_ami_copy" "example" {
description = "A copy of ami-xxxxxxxx"
source_ami_id = "ami-xxxxxxxx"
source_ami_region = "us-west-1"
tags {
Name = "HelloWorld"
}

View File

@ -21,6 +21,7 @@ resource "aws_api_gateway_account" "demo" {
resource "aws_iam_role" "cloudwatch" {
name = "api_gateway_cloudwatch_global"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
@ -41,6 +42,7 @@ EOF
resource "aws_iam_role_policy" "cloudwatch" {
name = "default"
role = "${aws_iam_role.cloudwatch.id}"
policy = <<EOF
{
"Version": "2012-10-17",

View File

@ -27,6 +27,7 @@ resource "aws_api_gateway_rest_api" "demo" {
resource "aws_iam_role" "invocation_role" {
name = "api_gateway_auth_invocation"
path = "/"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
@ -47,6 +48,7 @@ EOF
resource "aws_iam_role_policy" "invocation_policy" {
name = "default"
role = "${aws_iam_role.invocation_role.id}"
policy = <<EOF
{
"Version": "2012-10-17",
@ -63,6 +65,7 @@ EOF
resource "aws_iam_role" "lambda" {
name = "demo-lambda"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",

View File

@ -16,7 +16,6 @@ Provides an API Gateway Client Certificate.
resource "aws_api_gateway_client_certificate" "demo" {
description = "My client certificate"
}
```
## Argument Reference

View File

@ -99,6 +99,7 @@ resource "aws_lambda_function" "lambda" {
# IAM
resource "aws_iam_role" "role" {
name = "myrole"
assume_role_policy = <<POLICY
{
"Version": "2012-10-17",

View File

@ -23,6 +23,7 @@ resource "aws_api_gateway_model" "MyDemoModel" {
name = "user"
description = "a JSON schema"
content_type = "application/json"
schema = <<EOF
{
"type": "object"

View File

@ -16,6 +16,7 @@ Provides an application cookie stickiness policy, which allows an ELB to wed its
resource "aws_elb" "lb" {
name = "test-lb"
availability_zones = ["us-east-1a"]
listener {
instance_port = 8000
instance_protocol = "http"

View File

@ -30,6 +30,7 @@ resource "aws_autoscaling_group" "foobar" {
name = "terraform-test-foobar5"
health_check_type = "EC2"
termination_policies = ["OldestInstance"]
tag {
key = "Foo"
value = "foo-bar"
@ -43,11 +44,13 @@ resource "aws_autoscaling_lifecycle_hook" "foobar" {
default_result = "CONTINUE"
heartbeat_timeout = 2000
lifecycle_transition = "autoscaling:EC2_INSTANCE_LAUNCHING"
notification_metadata = <<EOF
{
"foo": "bar"
}
EOF
notification_target_arn = "arn:aws:sqs:us-east-1:444455556666:queue1*"
role_arn = "arn:aws:iam::123456789012:role/S3Access"
}

View File

@ -22,27 +22,32 @@ resource "aws_autoscaling_notification" "example_notifications" {
"${aws_autoscaling_group.bar.name}",
"${aws_autoscaling_group.foo.name}",
]
notifications = [
"autoscaling:EC2_INSTANCE_LAUNCH",
"autoscaling:EC2_INSTANCE_TERMINATE",
"autoscaling:EC2_INSTANCE_LAUNCH_ERROR"
"autoscaling:EC2_INSTANCE_LAUNCH_ERROR",
]
topic_arn = "${aws_sns_topic.example.arn}"
}
resource "aws_sns_topic" "example" {
name = "example-topic"
# arn is an exported attribute
}
resource "aws_autoscaling_group" "bar" {
name = "foobar1-terraform-test"
[... ASG attributes ...]
# ...
}
resource "aws_autoscaling_group" "foo" {
name = "barfoo-terraform-test"
[... ASG attributes ...]
# ...
}
```

View File

@ -15,9 +15,11 @@ Provides a CloudFormation Stack resource.
```
resource "aws_cloudformation_stack" "network" {
name = "networking-stack"
parameters {
VPCCidr = "10.0.0.0/16"
}
template_body = <<STACK
{
"Parameters" : {

View File

@ -92,7 +92,7 @@ data "aws_iam_policy_document" "s3_policy" {
}
resource "aws_s3_bucket" "bucket" {
...
# ...
policy = "${data.aws_iam_policy_document.s3_policy.json}"
}
```

View File

@ -22,6 +22,7 @@ resource "aws_cloudtrail" "foobar" {
resource "aws_s3_bucket" "foo" {
bucket = "tf-test-trail"
force_destroy = true
policy = <<POLICY
{
"Version": "2012-10-17",

View File

@ -16,6 +16,7 @@ Provides a CloudWatch Event Rule resource.
resource "aws_cloudwatch_event_rule" "console" {
name = "capture-aws-sign-in"
description = "Capture each AWS Console Sign In"
event_pattern = <<PATTERN
{
"detail-type": [

View File

@ -22,6 +22,7 @@ resource "aws_cloudwatch_event_target" "yada" {
resource "aws_cloudwatch_event_rule" "console" {
name = "capture-ec2-scaling-events"
description = "Capture all EC2 scaling events"
event_pattern = <<PATTERN
{
"source": [

View File

@ -45,9 +45,11 @@ resource "aws_cloudwatch_metric_alarm" "bat" {
period = "120"
statistic = "Average"
threshold = "80"
dimensions {
AutoScalingGroupName = "${aws_autoscaling_group.bar.name}"
}
alarm_description = "This metric monitor ec2 cpu utilization"
alarm_actions = ["${aws_autoscaling_policy.bat.arn}"]
}

View File

@ -20,6 +20,7 @@ in all regions - available regions are listed
resource "aws_codecommit_trigger" "test" {
depends_on = ["aws_codecommit_repository.test"]
repository_name = "my_test_repository"
trigger {
name = "noname"
events = ["all"]

View File

@ -15,6 +15,7 @@ Provides a CodeBuild Project resource.
```
resource "aws_iam_role" "codebuild_role" {
name = "codebuild-role-"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
@ -35,6 +36,7 @@ resource "aws_iam_policy" "codebuild_policy" {
name = "codebuild-policy"
path = "/service-role/"
description = "Policy used in trust relationship with CodeBuild"
policy = <<POLICY
{
"Version": "2012-10-17",

View File

@ -13,9 +13,9 @@ Provides a CodeDeploy deployment config for an application
## Example Usage
```
resource "aws_codedeploy_deployment_config" "foo" {
deployment_config_name = "test-deployment-config"
minimum_healthy_hosts {
type = "HOST_COUNT"
value = 2

View File

@ -20,6 +20,7 @@ resource "aws_codedeploy_app" "foo_app" {
resource "aws_iam_role_policy" "foo_policy" {
name = "foo_policy"
role = "${aws_iam_role.foo_role.id}"
policy = <<EOF
{
"Version": "2012-10-17",
@ -47,6 +48,7 @@ EOF
resource "aws_iam_role" "foo_role" {
name = "foo_role"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",

View File

@ -17,10 +17,12 @@ Provides an AWS Config Rule.
```
resource "aws_config_config_rule" "r" {
name = "example"
source {
owner = "AWS"
source_identifier = "S3_BUCKET_VERSIONING_ENABLED"
}
depends_on = ["aws_config_configuration_recorder.foo"]
}
@ -31,6 +33,7 @@ resource "aws_config_configuration_recorder" "foo" {
resource "aws_iam_role" "r" {
name = "my-awsconfig-role"
assume_role_policy = <<POLICY
{
"Version": "2012-10-17",
@ -51,6 +54,7 @@ POLICY
resource "aws_iam_role_policy" "p" {
name = "my-awsconfig-policy"
role = "${aws_iam_role.r.id}"
policy = <<POLICY
{
"Version": "2012-10-17",

View File

@ -22,6 +22,7 @@ resource "aws_config_configuration_recorder" "foo" {
resource "aws_iam_role" "r" {
name = "awsconfig-example"
assume_role_policy = <<POLICY
{
"Version": "2012-10-17",

View File

@ -42,6 +42,7 @@ resource "aws_config_configuration_recorder" "foo" {
resource "aws_iam_role" "r" {
name = "example-awsconfig"
assume_role_policy = <<POLICY
{
"Version": "2012-10-17",

View File

@ -33,6 +33,7 @@ resource "aws_config_configuration_recorder" "foo" {
resource "aws_iam_role" "r" {
name = "awsconfig-example"
assume_role_policy = <<POLICY
{
"Version": "2012-10-17",
@ -53,6 +54,7 @@ POLICY
resource "aws_iam_role_policy" "p" {
name = "awsconfig-example"
role = "${aws_iam_role.r.id}"
policy = <<POLICY
{
"Version": "2012-10-17",

View File

@ -19,6 +19,7 @@ resource "aws_customer_gateway" "main" {
bgp_asn = 65000
ip_address = "172.83.124.10"
type = "ipsec.1"
tags {
Name = "main-customer-gateway"
}

View File

@ -33,6 +33,7 @@ resource "aws_db_event_subscription" "default" {
source_type = "db-instance"
source_ids = ["${aws_db_instance.default.id}"]
event_categories = [
"availability",
"deletion",
@ -43,7 +44,7 @@ resource "aws_db_event_subscription" "default" {
"notification",
"read replica",
"recovery",
"restoration"
"restoration",
]
}
```

View File

@ -19,6 +19,7 @@ resource "aws_db_option_group" "bar" {
option {
option_name = "Timezone"
option_settings {
name = "TIME_ZONE"
value = "UTC"

View File

@ -16,6 +16,7 @@ Provides an RDS DB subnet group resource.
resource "aws_db_subnet_group" "default" {
name = "main"
subnet_ids = ["${aws_subnet.frontend.id}", "${aws_subnet.backend.id}"]
tags {
Name = "My DB subnet group"
}

View File

@ -88,7 +88,6 @@ resource "aws_default_network_acl" "default" {
from_port = 0
to_port = 0
}
}
```
@ -105,6 +104,7 @@ resource "aws_vpc" "mainvpc" {
resource "aws_default_network_acl" "default" {
default_network_acl_id = "${aws_vpc.mainvpc.default_network_acl_id}"
# no rules defined, deny all traffic in this ACL
}
```

View File

@ -45,8 +45,9 @@ a conflict of rule settings and will overwrite routes.
```
resource "aws_default_route_table" "r" {
default_route_table_id = "${aws_vpc.foo.default_route_table_id}"
route {
...
# ...
}
tags {

View File

@ -33,6 +33,7 @@ resource "aws_subnet" "foo" {
availability_zone = "us-west-2a"
cidr_block = "10.0.1.0/24"
}
resource "aws_subnet" "bar" {
vpc_id = "${aws_vpc.main.id}"
availability_zone = "us-west-2b"

View File

@ -26,9 +26,11 @@ resource "aws_dms_endpoint" "test" {
port = 3306
server_name = "test"
ssl_mode = "none"
tags {
Name = "test"
}
username = "test"
}
```

View File

@ -27,9 +27,11 @@ resource "aws_dms_replication_instance" "test" {
replication_instance_class = "dms.t2.micro"
replication_instance_id = "test-dms-replication-instance-tf"
replication_subnet_group_id = "${aws_dms_replication_subnet_group.test-dms-replication-subnet-group-tf}"
tags {
Name = "test"
}
vpc_security_group_ids = [
"sg-12345678",
]

View File

@ -17,6 +17,7 @@ Provides a DMS (Data Migration Service) replication subnet group resource. DMS r
resource "aws_dms_replication_subnet_group" "test" {
replication_subnet_group_description = "Test replication subnet group"
replication_subnet_group_id = "test-dms-replication-subnet-group-tf"
subnet_ids = [
"subnet-12345678",
]

View File

@ -22,9 +22,11 @@ resource "aws_dms_replication_task" "test" {
replication_task_settings = "..."
source_endpoint_arn = "${aws_dms_endpoint.test-dms-source-endpoint-tf.endpoint_arn}"
table_mappings = "{\"rules\":[{\"rule-type\":\"selection\",\"rule-id\":\"1\",\"rule-name\":\"1\",\"object-locator\":{\"schema-name\":\"%\",\"table-name\":\"%\"},\"rule-action\":\"include\"}]}"
tags {
Name = "test"
}
target_endpoint_arn = "${aws_dms_endpoint.test-dms-target-endpoint-tf.endpoint_arn}"
}
```

View File

@ -22,18 +22,22 @@ resource "aws_dynamodb_table" "basic-dynamodb-table" {
write_capacity = 20
hash_key = "UserId"
range_key = "GameTitle"
attribute {
name = "UserId"
type = "S"
}
attribute {
name = "GameTitle"
type = "S"
}
attribute {
name = "TopScore"
type = "N"
}
global_secondary_index {
name = "GameTitleIndex"
hash_key = "GameTitle"
@ -43,6 +47,7 @@ resource "aws_dynamodb_table" "basic-dynamodb-table" {
projection_type = "INCLUDE"
non_key_attributes = ["UserId"]
}
tags {
Name = "dynamodb-table-1"
Environment = "production"

View File

@ -25,6 +25,7 @@ resource "aws_ecr_repository" "foo" {
resource "aws_ecr_repository_policy" "foopolicy" {
repository = "${aws_ecr_repository.foo.name}"
policy = <<EOF
{
"Version": "2008-10-17",

View File

@ -15,6 +15,7 @@ Provides an Elastic File System (EFS) resource.
```
resource "aws_efs_file_system" "foo" {
creation_token = "my-product"
tags {
Name = "MyProduct"
}

View File

@ -26,6 +26,7 @@ resource "aws_instance" "web" {
ami = "ami-21f78e11"
availability_zone = "us-west-2a"
instance_type = "t1.micro"
tags {
Name = "HelloWorld"
}

View File

@ -90,6 +90,7 @@ resource "aws_elastic_beanstalk_environment" "tfenvtest" {
name = "tf-test-name"
application = "${aws_elastic_beanstalk_application.tftest.name}"
solution_stack_name = "64bit Amazon Linux 2015.03 v2.0.3 running Go 1.4"
setting {
namespace = "aws:ec2:vpc"
name = "VPCId"

View File

@ -19,6 +19,7 @@ ElastiCache cluster **inside** of a VPC. If you are on EC2 Classic, see the
```
resource "aws_vpc" "foo" {
cidr_block = "10.0.0.0/16"
tags {
Name = "tf-test"
}
@ -28,6 +29,7 @@ resource "aws_subnet" "foo" {
vpc_id = "${aws_vpc.foo.id}"
cidr_block = "10.0.0.0/24"
availability_zone = "us-west-2a"
tags {
Name = "tf-test"
}

View File

@ -15,6 +15,7 @@ description: |-
resource "aws_elasticsearch_domain" "es" {
domain_name = "tf-test"
elasticsearch_version = "1.5"
advanced_options {
"rest.action.multi.allow_explicit_index" = true
}

View File

@ -20,6 +20,7 @@ resource "aws_elasticsearch_domain" "example" {
resource "aws_elasticsearch_domain_policy" "main" {
domain_name = "${aws_elasticsearch_domain.example.domain_name}"
access_policies = <<POLICIES
{
"Version": "2012-10-17",

View File

@ -25,6 +25,7 @@ resource "aws_cloudwatch_log_group" "test_log_group" {
resource "aws_iam_role" "test_role" {
name = "test_role"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
@ -45,6 +46,7 @@ EOF
resource "aws_iam_role_policy" "test_policy" {
name = "test_policy"
role = "${aws_iam_role.test_role.id}"
policy = <<EOF
{
"Version": "2012-10-17",

View File

@ -17,10 +17,12 @@ more information on managing IAM Groups or IAM Users, see [IAM Groups][1] or
```
resource "aws_iam_group_membership" "team" {
name = "tf-testing-group-membership"
users = [
"${aws_iam_user.user_one.name}",
"${aws_iam_user.user_two.name}",
]
group = "${aws_iam_group.group.name}"
}

View File

@ -16,6 +16,7 @@ Provides an IAM policy attached to a group.
resource "aws_iam_group_policy" "my_developer_policy" {
name = "my_developer_policy"
group = "${aws_iam_group.my_developers.id}"
policy = <<EOF
{
"Version": "2012-10-17",

View File

@ -21,6 +21,7 @@ resource "aws_iam_instance_profile" "test_profile" {
resource "aws_iam_role" "role" {
name = "test_role"
path = "/"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",

View File

@ -15,6 +15,7 @@ resource "aws_iam_policy" "policy" {
name = "test_policy"
path = "/"
description = "My test policy"
policy = <<EOF
{
"Version": "2012-10-17",

View File

@ -16,9 +16,11 @@ Attaches a Managed IAM Policy to user(s), role(s), and/or group(s)
resource "aws_iam_user" "user" {
name = "test-user"
}
resource "aws_iam_role" "role" {
name = "test-role"
}
resource "aws_iam_group" "group" {
name = "test-group"
}
@ -31,9 +33,9 @@ resource "aws_iam_policy" "policy" {
resource "aws_iam_policy_attachment" "test-attach" {
name = "test-attachment"
users = ["${aws_iam_user.user.name}"]
roles = ["${aws_iam_role.role.name}"]
groups = ["${aws_iam_group.group.name}"]
users = ["{aws_iam_user.user.name}"]
roles = ["{aws_iam_role.role.name}"]
groups = ["{aws_iam_group.group.name}"]
policy_arn = "${aws_iam_policy.policy.arn}"
}
```

View File

@ -15,6 +15,7 @@ Provides an IAM role.
```
resource "aws_iam_role" "test_role" {
name = "test_role"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",

View File

@ -16,6 +16,7 @@ Provides an IAM role policy.
resource "aws_iam_role_policy" "test_policy" {
name = "test_policy"
role = "${aws_iam_role.test_role.id}"
policy = <<EOF
{
"Version": "2012-10-17",
@ -34,6 +35,7 @@ EOF
resource "aws_iam_role" "test_role" {
name = "test_role"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",

View File

@ -36,6 +36,7 @@ resource "aws_iam_server_certificate" "test_cert" {
```
resource "aws_iam_server_certificate" "test_cert_alt" {
name = "alt_test_cert"
certificate_body = <<EOF
-----BEGIN CERTIFICATE-----
[......] # cert contents

View File

@ -25,6 +25,7 @@ resource "aws_iam_access_key" "lb" {
resource "aws_iam_user_policy" "lb_ro" {
name = "test"
user = "${aws_iam_user.lb.name}"
policy = <<EOF
{
"Version": "2012-10-17",

View File

@ -16,6 +16,7 @@ Provides an IAM policy attached to a user.
resource "aws_iam_user_policy" "lb_ro" {
name = "test"
user = "${aws_iam_user.lb.name}"
policy = <<EOF
{
"Version": "2012-10-17",

View File

@ -22,20 +22,24 @@ provider "aws" {
data "aws_ami" "ubuntu" {
most_recent = true
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-trusty-14.04-amd64-server-*"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
owners = ["099720109477"] # Canonical
}
resource "aws_instance" "web" {
ami = "${data.aws_ami.ubuntu.id}"
instance_type = "t2.micro"
tags {
Name = "HelloWorld"
}

View File

@ -23,6 +23,7 @@ resource "aws_s3_bucket" "bucket" {
resource "aws_iam_role" "firehose_role" {
name = "firehose_test_role"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
@ -43,6 +44,7 @@ EOF
resource "aws_kinesis_firehose_delivery_stream" "test_stream" {
name = "terraform-kinesis-firehose-test-stream"
destination = "s3"
s3_configuration {
role_arn = "${aws_iam_role.firehose_role.arn}"
bucket_arn = "${aws_s3_bucket.bucket.arn}"
@ -65,6 +67,7 @@ resource "aws_redshift_cluster" "test_cluster" {
resource "aws_kinesis_firehose_delivery_stream" "test_stream" {
name = "terraform-kinesis-firehose-test-stream"
destination = "redshift"
s3_configuration {
role_arn = "${aws_iam_role.firehose_role.arn}"
bucket_arn = "${aws_s3_bucket.bucket.arn}"
@ -72,6 +75,7 @@ resource "aws_kinesis_firehose_delivery_stream" "test_stream" {
buffer_interval = 400
compression_format = "GZIP"
}
redshift_configuration {
role_arn = "${aws_iam_role.firehose_role.arn}"
cluster_jdbcurl = "jdbc:redshift://${aws_redshift_cluster.test_cluster.endpoint}/${aws_redshift_cluster.test_cluster.database_name}"
@ -94,6 +98,7 @@ resource "aws_elasticsearch_domain" "test_cluster" {
resource "aws_kinesis_firehose_delivery_stream" "test_stream" {
name = "terraform-kinesis-firehose-test-stream"
destination = "redshift"
s3_configuration {
role_arn = "${aws_iam_role.firehose_role.arn}"
bucket_arn = "${aws_s3_bucket.bucket.arn}"

View File

@ -20,10 +20,12 @@ resource "aws_kinesis_stream" "test_stream" {
name = "terraform-kinesis-test"
shard_count = 1
retention_period = 48
shard_level_metrics = [
"IncomingBytes",
"OutgoingBytes"
"OutgoingBytes",
]
tags {
Environment = "test"
}

View File

@ -15,8 +15,7 @@ the [account limits](http://docs.aws.amazon.com/kms/latest/developerguide/limits
## Example Usage
```
resource "aws_kms_key" "a" {
}
resource "aws_kms_key" "a" {}
resource "aws_kms_alias" "a" {
name = "alias/my-key-alias"

View File

@ -17,6 +17,7 @@ For information about Lambda and how to use it, see [What is AWS Lambda?][1]
```
resource "aws_iam_role" "iam_for_lambda" {
name = "iam_for_lambda"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
@ -40,6 +41,7 @@ resource "aws_lambda_function" "test_lambda" {
role = "${aws_iam_role.iam_for_lambda.arn}"
handler = "exports.test"
source_code_hash = "${base64sha256(file("lambda_function_payload.zip"))}"
environment {
variables = {
foo = "bar"

View File

@ -40,6 +40,7 @@ resource "aws_lambda_function" "test_lambda" {
resource "aws_iam_role" "iam_for_lambda" {
name = "iam_for_lambda"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
@ -88,6 +89,7 @@ resource "aws_lambda_function" "func" {
resource "aws_iam_role" "default" {
name = "iam_for_lambda_with_sns"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",

View File

@ -15,14 +15,17 @@ Provides a resource to create a new launch configuration, used for autoscaling g
```
data "aws_ami" "ubuntu" {
most_recent = true
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-trusty-14.04-amd64-server-*"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
owners = ["099720109477"] # Canonical
}
@ -46,14 +49,17 @@ with `name_prefix`. Example:
```
data "aws_ami" "ubuntu" {
most_recent = true
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-trusty-14.04-amd64-server-*"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
owners = ["099720109477"] # Canonical
}
@ -93,14 +99,17 @@ for more information or how to launch [Spot Instances][3] with Terraform.
```
data "aws_ami" "ubuntu" {
most_recent = true
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-trusty-14.04-amd64-server-*"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
owners = ["099720109477"] # Canonical
}
@ -108,6 +117,7 @@ resource "aws_launch_configuration" "as_conf" {
image_id = "${data.aws_ami.ubuntu.id}"
instance_type = "m4.large"
spot_price = "0.001"
lifecycle {
create_before_destroy = true
}

View File

@ -16,6 +16,7 @@ Provides a load balancer cookie stickiness policy, which allows an ELB to contro
resource "aws_elb" "lb" {
name = "test-lb"
availability_zones = ["us-east-1a"]
listener {
instance_port = 8000
instance_protocol = "http"

View File

@ -16,6 +16,7 @@ Provides a load balancer SSL negotiation policy, which allows an ELB to control
resource "aws_elb" "lb" {
name = "test-lb"
availability_zones = ["us-east-1a"]
listener {
instance_port = 8000
instance_protocol = "https"
@ -29,30 +30,37 @@ resource "aws_lb_ssl_negotiation_policy" "foo" {
name = "foo-policy"
load_balancer = "${aws_elb.lb.id}"
lb_port = 443
attribute {
name = "Protocol-TLSv1"
value = "false"
}
attribute {
name = "Protocol-TLSv1.1"
value = "false"
}
attribute {
name = "Protocol-TLSv1.2"
value = "true"
}
attribute {
name = "Server-Defined-Cipher-Order"
value = "true"
}
attribute {
name = "ECDHE-RSA-AES128-GCM-SHA256"
value = "true"
}
attribute {
name = "AES128-GCM-SHA256"
value = "true"
}
attribute {
name = "EDH-RSA-DES-CBC3-SHA"
value = "false"

View File

@ -35,6 +35,7 @@ resource "aws_load_balancer_policy" "wu-tang-ca-pubkey-policy" {
load_balancer_name = "${aws_elb.wu-tang.name}"
policy_name = "wu-tang-ca-pubkey-policy"
policy_type_name = "PublicKeyPolicyType"
policy_attribute = {
name = "PublicKey"
value = "${file("wu-tang-pubkey")}"
@ -45,6 +46,7 @@ resource "aws_load_balancer_policy" "wu-tang-root-ca-backend-auth-policy" {
load_balancer_name = "${aws_elb.wu-tang.name}"
policy_name = "wu-tang-root-ca-backend-auth-policy"
policy_type_name = "BackendServerAuthenticationPolicyType"
policy_attribute = {
name = "PublicKeyPolicyName"
value = "${aws_load_balancer_policy.wu-tang-root-ca-pubkey-policy.policy_name}"
@ -54,8 +56,9 @@ resource "aws_load_balancer_policy" "wu-tang-root-ca-backend-auth-policy" {
resource "aws_load_balancer_backend_server_policy" "wu-tang-backend-auth-policies-443" {
load_balancer_name = "${aws_elb.wu-tang.name}"
instance_port = 443
policy_names = [
"${aws_load_balancer_policy.wu-tang-root-ca-backend-auth-policy.policy_name}"
"${aws_load_balancer_policy.wu-tang-root-ca-backend-auth-policy.policy_name}",
]
}
```

View File

@ -35,10 +35,12 @@ resource "aws_load_balancer_policy" "wu-tang-ssl" {
load_balancer_name = "${aws_elb.wu-tang.name}"
policy_name = "wu-tang-ssl"
policy_type_name = "SSLNegotiationPolicyType"
policy_attribute = {
name = "ECDHE-ECDSA-AES128-GCM-SHA256"
value = "true"
}
policy_attribute = {
name = "Protocol-TLSv1.2"
value = "true"
@ -48,8 +50,9 @@ resource "aws_load_balancer_policy" "wu-tang-ssl" {
resource "aws_load_balancer_listener_policy" "wu-tang-listener-policies-443" {
load_balancer_name = "${aws_elb.wu-tang.name}"
load_balancer_port = 443
policy_names = [
"${aws_load_balancer_policy.wu-tang-ssl.policy_name}"
"${aws_load_balancer_policy.wu-tang-ssl.policy_name}",
]
}
```

View File

@ -34,6 +34,7 @@ resource "aws_load_balancer_policy" "wu-tang-ca-pubkey-policy" {
load_balancer_name = "${aws_elb.wu-tang.name}"
policy_name = "wu-tang-ca-pubkey-policy"
policy_type_name = "PublicKeyPolicyType"
policy_attribute = {
name = "PublicKey"
value = "${file("wu-tang-pubkey")}"
@ -44,6 +45,7 @@ resource "aws_load_balancer_policy" "wu-tang-root-ca-backend-auth-policy" {
load_balancer_name = "${aws_elb.wu-tang.name}"
policy_name = "wu-tang-root-ca-backend-auth-policy"
policy_type_name = "BackendServerAuthenticationPolicyType"
policy_attribute = {
name = "PublicKeyPolicyName"
value = "${aws_load_balancer_policy.wu-tang-root-ca-pubkey-policy.policy_name}"
@ -54,10 +56,12 @@ resource "aws_load_balancer_policy" "wu-tang-ssl" {
load_balancer_name = "${aws_elb.wu-tang.name}"
policy_name = "wu-tang-ssl"
policy_type_name = "SSLNegotiationPolicyType"
policy_attribute = {
name = "ECDHE-ECDSA-AES128-GCM-SHA256"
value = "true"
}
policy_attribute = {
name = "Protocol-TLSv1.2"
value = "true"
@ -67,16 +71,18 @@ resource "aws_load_balancer_policy" "wu-tang-ssl" {
resource "aws_load_balancer_backend_server_policy" "wu-tang-backend-auth-policies-443" {
load_balancer_name = "${aws_elb.wu-tang.name}"
instance_port = 443
policy_names = [
"${aws_load_balancer_policy.wu-tang-root-ca-backend-auth-policy.policy_name}"
"${aws_load_balancer_policy.wu-tang-root-ca-backend-auth-policy.policy_name}",
]
}
resource "aws_load_balancer_listener_policy" "wu-tang-listener-policies-443" {
load_balancer_name = "${aws_elb.wu-tang.name}"
load_balancer_port = 443
policy_names = [
"${aws_load_balancer_policy.wu-tang-ssl.policy_name}"
"${aws_load_balancer_policy.wu-tang-ssl.policy_name}",
]
}
```

Some files were not shown because too many files have changed in this diff Show More