diff --git a/README.md b/README.md new file mode 100644 index 0000000..2a023c9 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# terraformec2 diff --git a/main.tf b/main.tf new file mode 100644 index 0000000..e675bef --- /dev/null +++ b/main.tf @@ -0,0 +1,8 @@ +resource "aws_instance" "app_server" { + ami = var.ami + instance_type = var.instance_type + + tags = { + Name = var.tag + } +} diff --git a/module.tf b/module.tf new file mode 100644 index 0000000..f5ddc22 --- /dev/null +++ b/module.tf @@ -0,0 +1,3 @@ +module "ec2-module" { + source = "./module/ec2/" +} diff --git a/outputs.tf b/outputs.tf new file mode 100644 index 0000000..72d8678 --- /dev/null +++ b/outputs.tf @@ -0,0 +1,9 @@ +output "instance_id" { + description = "EC2 Instance ID" + value = aws_instance.app_server.id +} + +output "instance_public_ip" { + description = "Public IP to EC2 Instance" + value = aws_instance.app_server.public_ip +} diff --git a/providers.tf b/providers.tf new file mode 100644 index 0000000..b935e84 --- /dev/null +++ b/providers.tf @@ -0,0 +1,15 @@ +terraform { + required_providers { + aws = { + source = "hashicorp/aws" + version = "~> 3.27" + } + } + + required_version = ">= 0.14.9" +} + +provider "aws" { + profile = "default" + region = "var.region" +} diff --git a/variables.tf b/variables.tf new file mode 100644 index 0000000..570bcf9 --- /dev/null +++ b/variables.tf @@ -0,0 +1,19 @@ +variable "region" { + type = string + default = "us-west-2" +} + +variable "ami" { + type = string + default = "ami-026b57f3c383c2eec" +} + +variable "instance_type" { + type = string + default = "t2.micro" +} + +variable "tag" { + type = string + default = "acoop_instance" +}