Skip to content
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
11 changes: 11 additions & 0 deletions app_server/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
3 changes: 3 additions & 0 deletions app_server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# AWS app server

This module provisions an AWS instance configured application website hosting.
38 changes: 38 additions & 0 deletions app_server/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
provider "aws" {
region = var.region
}

module "ec2" {
source = "../.."

}

variable "server_name" {
default = ""
}

variable "region" {
default = ""
}
resource "aws_instance" "app_server" {
ami = data.aws_ami.amazon_linux.id
instance_type = "t2.micro"

tags = {
Name = var.server_name
}
}

data "aws_ami" "amazon_linux" {
most_recent = true

owners = ["amazon"]

filter {
name = "name"

values = [
"amzn-ami-hvm-*-x86_64-gp2",
]
}
}
11 changes: 11 additions & 0 deletions app_server/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Output variable definitions

output "arn" {
description = "ARN of the server"
value = aws_instance.app_server.arn
}

output "server_name" {
description = "Name (id) of the sever"
value = aws_instance.app_server.id
}
6 changes: 6 additions & 0 deletions app_server/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
region = "us-east-2"

server_name = "example_app_server"