Last active
May 23, 2018 19:55
-
-
Save scarolan/dfcf1af65821bf758dbc634a94164fde to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# My first Terraform | |
variable "access_key" {} | |
variable "secret_key" {} | |
variable "ami" {} | |
variable "subnet_id" {} | |
variable "instance_type" {} | |
variable "vpc_security_group_id" {} | |
variable "identity" {} | |
variable "region" { | |
default = "us-west-2" | |
} | |
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}" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# My first Terraform module | |
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}" | |
vpc_security_group_ids = ["${var.vpc_security_group_id}"] | |
subnet_id = "${var.subnet_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