Skip to content

Instantly share code, notes, and snippets.

@phinze
Last active December 9, 2015 20:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phinze/30b33f860cebecb91dd8 to your computer and use it in GitHub Desktop.
Save phinze/30b33f860cebecb91dd8 to your computer and use it in GitHub Desktop.
provider "aws" {
access_key = "foo"
secret_key = "bar"
region = "us-east-1"
}
module "vpc" {
source = "./tf_aws_vpc"
name = "keyprovidertest"
cidr = "10.0.0.0/16"
private_subnets = "10.0.1.0/24"
public_subnets = "10.0.101.0/24"
azs = ""
}
resource "aws_security_group" "test" {
vpc_id = "${module.vpc.vpc_id}"
ingress {
protocol = "-1"
from_port = 0
to_port = 0
cidr_blocks = ["0.0.0.0/0"]
}
egress {
protocol = "-1"
from_port = 0
to_port = 0
cidr_blocks = ["0.0.0.0/0"]
}
}
resource "aws_instance" "test" {
ami = "ami-0f8bce65"
instance_type = "t2.micro"
key_name = "terraform-testing"
subnet_id = "${module.vpc.public_subnets}"
vpc_security_group_ids = ["${aws_security_group.test.id}"]
provisioner "file" {
source = "script.sh"
destination = "/tmp/script.sh"
connection {
agent = false
user = "ubuntu"
key_file = "~/.ssh/terraform-testing.pem"
}
}
provisioner "remote-exec" {
inline = [
"echo 1"
]
connection {
agent = false
user = "ubuntu"
key_file = "~/.ssh/terraform-testing.pem"
}
}
tags {
Name = "test_server"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment