Skip to content

Instantly share code, notes, and snippets.

@Ayush-Singhal28

Ayush-Singhal28/main.tf

Last active Oct 4, 2018
Embed
What would you like to do?
provider "aws" {
access_key = "${var.access_key}"
secret_key = "${var.secret_key}"
region = "us-west-2"
}
resource "aws_instance" "awsInstance" {
ami = "ami-c0f936b8"
instance_type = "t2.micro"
key_name = "${var.key_name}"
connection {
user = "ec2-user"
private_key = "${file(var.private_key_path)}"
}
provisioner "remote-exec" {
inline = [
"sudo yum install nginx -y",
"sudo service nginx start",
"echo '<html><head><title>Learning terraform</title></head><body><h1>Automating Infrastructure on AWS Using Terraform</h1></body></html>' | sudo tee /usr/share/nginx/html/index.html"
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment