mirror of
https://codeberg.org/scottslowe/learning-tools.git
synced 2026-03-11 09:04:37 +00:00
Clean up simple EC2 environment
Remove hard-coded variables and move to `terraform.tfvars` for better portability. Rename variables file for greater consistency across environments. Add output to display IP address of spawned EC2 instance. Signed-off-by: Scott Lowe <scott.lowe@scottlowe.org>
This commit is contained in:
parent
9476c3ab2f
commit
0014866674
3 changed files with 9 additions and 4 deletions
3
terraform/aws/simple-ec2/output.tf
Normal file
3
terraform/aws/simple-ec2/output.tf
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
output "instance_ip_address" {
|
||||
value = "${aws_instance.test-01.public_ip}"
|
||||
}
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
provider "aws" {
|
||||
region = "us-west-2"
|
||||
region = "${var.user_region}"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,17 +1,19 @@
|
|||
variable "user_region" {
|
||||
type = "string"
|
||||
description = "AWS region in which to create all resources"
|
||||
}
|
||||
|
||||
variable "keypair" {
|
||||
type = "string"
|
||||
description = "AWS SSH keypair to use to connect to instances"
|
||||
default = "aws_rsa"
|
||||
}
|
||||
|
||||
variable "flavor" {
|
||||
type = "string"
|
||||
description = "AWS type to use when creating instances"
|
||||
default = "t2.micro"
|
||||
}
|
||||
|
||||
variable "sec-group" {
|
||||
type = "string"
|
||||
description = "AWS security group to apply to instances"
|
||||
default = "sg-7099b514"
|
||||
}
|
||||
Loading…
Reference in a new issue