From c7fd39a66562dd6f91f14ca0def8d7fc0d519a07 Mon Sep 17 00:00:00 2001 From: Brian Moore Date: Mon, 24 Oct 2022 23:46:12 -0400 Subject: [PATCH 1/2] 10242022 --- Ec2_instance/main.tf | 0 Ec2_instance/outputs.tf | 0 Ec2_instance/provider.tf | 0 Ec2_instance/variables.tf | 0 4 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 Ec2_instance/main.tf create mode 100644 Ec2_instance/outputs.tf create mode 100644 Ec2_instance/provider.tf create mode 100644 Ec2_instance/variables.tf diff --git a/Ec2_instance/main.tf b/Ec2_instance/main.tf new file mode 100644 index 0000000..e69de29 diff --git a/Ec2_instance/outputs.tf b/Ec2_instance/outputs.tf new file mode 100644 index 0000000..e69de29 diff --git a/Ec2_instance/provider.tf b/Ec2_instance/provider.tf new file mode 100644 index 0000000..e69de29 diff --git a/Ec2_instance/variables.tf b/Ec2_instance/variables.tf new file mode 100644 index 0000000..e69de29 From a263a6c31868908a283c6fbe1bf9fe0d9febaa37 Mon Sep 17 00:00:00 2001 From: Brian Moore Date: Tue, 25 Oct 2022 05:01:52 -0400 Subject: [PATCH 2/2] 10252022 --- Ec2_instance/main.tf | 8 ++++++++ Ec2_instance/outputs.tf | 9 +++++++++ Ec2_instance/provider.tf | 15 +++++++++++++++ Ec2_instance/variables.tf | 19 +++++++++++++++++++ 4 files changed, 51 insertions(+) diff --git a/Ec2_instance/main.tf b/Ec2_instance/main.tf index e69de29..fdabd83 100644 --- a/Ec2_instance/main.tf +++ b/Ec2_instance/main.tf @@ -0,0 +1,8 @@ +resource "aws_instance" "app_server" { + ami = var.ami_id + instance_type = var.instance + + tags = { + Name = var.tag + } +} \ No newline at end of file diff --git a/Ec2_instance/outputs.tf b/Ec2_instance/outputs.tf index e69de29..b942a3a 100644 --- a/Ec2_instance/outputs.tf +++ b/Ec2_instance/outputs.tf @@ -0,0 +1,9 @@ +output "instance_id" { + description = "ID of the EC2 instance" + value = aws_instance.app_server.id +} + +output "instance_public_ip" { + description = "Public IP address of the EC2 instance" + value = aws_instance.app_server.public_ip +} \ No newline at end of file diff --git a/Ec2_instance/provider.tf b/Ec2_instance/provider.tf index e69de29..d3a444b 100644 --- a/Ec2_instance/provider.tf +++ b/Ec2_instance/provider.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/Ec2_instance/variables.tf b/Ec2_instance/variables.tf index e69de29..572be2b 100644 --- a/Ec2_instance/variables.tf +++ b/Ec2_instance/variables.tf @@ -0,0 +1,19 @@ +variable "ami_id" { + type = string + default = "ami-09d3b3274b6c5d4aa" +} + +variable "instance" { + type = string + default = "t2.micro" +} + +variable "tag" { + type = string + default = "Bmoore_Instance" +} + +variable "region" { + type = string + default = "us-east-1" +} \ No newline at end of file