2015-11-10 16:15:41 +01:00
|
|
|
provider "aws" {
|
|
|
|
access_key = "foo"
|
|
|
|
secret_key = "bar"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_iam_policy" "policy" {
|
|
|
|
name = "test_policy"
|
|
|
|
path = "/"
|
|
|
|
description = "My test policy"
|
|
|
|
policy = <<EOF
|
|
|
|
{
|
|
|
|
"Version": "2012-10-17",
|
|
|
|
"Statement": [
|
|
|
|
{
|
|
|
|
"Action": [
|
|
|
|
"ec2:Describe*"
|
|
|
|
],
|
|
|
|
"Effect": "Allow",
|
|
|
|
"Resource": "*"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
}
|
2015-11-25 19:50:16 +01:00
|
|
|
|
|
|
|
resource "aws_instance" "test" {
|
|
|
|
ami = "foo"
|
|
|
|
|
|
|
|
provisioner "remote-exec" {
|
|
|
|
inline = [
|
|
|
|
<<EOT
|
|
|
|
sudo \
|
|
|
|
A=val \
|
|
|
|
B=val2 \
|
|
|
|
sh script.sh
|
|
|
|
EOT
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
2015-12-01 17:31:05 +01:00
|
|
|
|
|
|
|
resource "aws_instance" "heredocwithnumbers" {
|
|
|
|
ami = "foo"
|
|
|
|
|
|
|
|
provisioner "local-exec" {
|
|
|
|
command = <<FOO123
|
|
|
|
echo several
|
|
|
|
lines
|
|
|
|
of output
|
|
|
|
FOO123
|
|
|
|
}
|
|
|
|
}
|