Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

10252022 #18

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Ec2_instance/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
resource "aws_instance" "app_server" {
ami = var.ami_id
instance_type = var.instance

tags = {
Name = var.tag
}
}
9 changes: 9 additions & 0 deletions Ec2_instance/outputs.tf
Original file line number Diff line number Diff line change
@@ -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
}
15 changes: 15 additions & 0 deletions Ec2_instance/provider.tf
Original file line number Diff line number Diff line change
@@ -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
}
19 changes: 19 additions & 0 deletions Ec2_instance/variables.tf
Original file line number Diff line number Diff line change
@@ -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"
}