Skip to content

Instantly share code, notes, and snippets.

@100daysofdevops
Created March 12, 2019 16:09
Show Gist options
  • Select an option

  • Save 100daysofdevops/da397c8188a799448e669d14c5873dc2 to your computer and use it in GitHub Desktop.

Select an option

Save 100daysofdevops/da397c8188a799448e669d14c5873dc2 to your computer and use it in GitHub Desktop.
provider "aws" {
region = "us-west-2"
}
resource "aws_instance" "test-instance" {
ami = "${var.centos_ami}"
instance_type = "${var.instance_type}"
key_name = "${var.key_name}"
connection {
user = "centos"
private_key = "${file(var.key_path)}"
}
provisioner "remote-exec" {
inline = [
"sudo yum -y install httpd",
"sudo service httpd start"
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment