Skip to content

Instantly share code, notes, and snippets.

@scarolan
Last active June 6, 2018 18:50
Show Gist options
  • Save scarolan/02bc4f02a216a8206439f27f1c49a72f to your computer and use it in GitHub Desktop.
Save scarolan/02bc4f02a216a8206439f27f1c49a72f to your computer and use it in GitHub Desktop.
variable "access_key" {}
variable "secret_key" {}
variable "region" {}
variable ami {}
variable subnet_id {}
variable instance_type {
default = "t2.micro"
}
variable vpc_security_group_id {}
variable identity {}
provider "aws" {
access_key = "${var.access_key}"
secret_key = "${var.secret_key}"
region = "${var.region}"
}
module "server" {
source = "./server"
ami = "${var.ami}"
subnet_id = "${var.subnet_id}"
vpc_security_group_id = "${var.vpc_security_group_id}"
identity = "${var.identity}"
instance_type = "${var.instance_type}"
}
output "public_ip" {
value = "${module.server.public_ip}"
}
variable ami {}
variable subnet_id {}
variable instance_type {}
variable vpc_security_group_id {}
variable identity {}
resource "aws_instance" "web" {
ami = "${var.ami}"
instance_type = "${var.instance_type}"
subnet_id = "${var.subnet_id}"
vpc_security_group_ids = ["${var.vpc_security_group_id}"]
tags {
Identity = "${var.identity}"
}
}
output "public_ip" {
value = "${aws_instance.web.public_ip}"
}
output "public_dns" {
value = "${aws_instance.web.public_dns}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment