Skip to content

Instantly share code, notes, and snippets.

@k1LoW
Created September 1, 2017 09:32
Show Gist options
  • Save k1LoW/a90daec883149adb8e3aa1438c113f0e to your computer and use it in GitHub Desktop.
Save k1LoW/a90daec883149adb8e3aa1438c113f0e to your computer and use it in GitHub Desktop.
Test environment for Piculet `eval $(terraform output | sed 's/ //g' | sed 's/^/export /')` Raw
variable "region" {
default = "ap-northeast-1"
}
provider "aws" {
region = "${var.region}"
}
data "aws_caller_identity" "current" {}
resource "aws_iam_user" "test-iam-user" {
name = "piculet-test-iam-user"
path = "/"
}
resource "aws_iam_access_key" "test-iam-key" {
user = "${aws_iam_user.test-iam-user.name}"
}
resource "aws_iam_user_policy" "test-iam-user-policy" {
name = "piculet-test-iam-user-policy"
user = "${aws_iam_user.test-iam-user.name}"
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"ec2:*"
],
"Effect": "Allow",
"Resource": "*"
}
]
}
EOF
}
resource "aws_vpc" "test_vpc" {
cidr_block = "10.0.0.0/16"
tags {
Name = "piculet test vpc"
}
}
output "TEST_OWNER_ID" {
value = "${data.aws_caller_identity.current.account_id}"
}
output "TEST_AWS_REGION" {
value = "${var.region}"
}
output "TEST_VPC_ID" {
value = "${aws_vpc.test_vpc.id}"
}
output "TEST_EXPORT_DELAY" {
value = "1"
}
output "TEST_AWS_ACCESS_KEY_ID" {
value = "${aws_iam_access_key.test-iam-key.id}"
}
output "TEST_AWS_SECRET_ACCESS_KEY" {
value = "${aws_iam_access_key.test-iam-key.secret}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment