Skip to content
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.

Reorganize cloud-specific examples into subdirectories #59

Merged
merged 1 commit into from
Apr 1, 2021
Merged
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
.DS_Store
data.db
terraform.tfstate
terraform.tfstate.backup
.terraform/*
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ All of the examples in this repository are organized first by deployment
platform and then by programming language or web platform. For example:
**Docker/nodejs**.

Cloud-specific examples are in subdirectories for platform, such as **aws/aws-ecs**.

## Deploying Examples

You can experiment with the different examples by entering each directory and
Expand Down
File renamed without changes.
File renamed without changes.
63 changes: 63 additions & 0 deletions aws/aws-ecs/nodejs/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 2.70"
}
}
}

provider "aws" {
region = "us-west-2"
}

resource "aws_instance" "web" {
ami = "ami-04e229bcb91f0f16b" # Nginx
instance_type = "t2.medium"
count = 1

vpc_security_group_ids = ["${aws_security_group.default.id}"]

tags = {
Name = "Geoffrey"
}
}


resource "aws_security_group" "default" {
name_prefix = "Geoffrey"

ingress {
from_port = 80
to_port = 80
protocol = "tcp"

}

ingress {
from_port = 22
to_port = 22
protocol = "tcp"

}

egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}

tags = {
"Created-by" = "Geoffrey"

}
}

output "public_ip" {
value = ["${aws_instance.web.*.public_ip}"]
}

output "public_dns" {
value = ["${aws_instance.web.*.public_dns}"]
}
26 changes: 26 additions & 0 deletions aws/aws-ecs/nodejs/packer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"variables": {
"aws_access_key": "",
"aws_secret_key": ""
},
"builders": [
{
"type": "amazon-ebs",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"region": "us-east-1",
"source_ami_filter": {
"filters": {
"virtualization-type": "hvm",
"name": "ubuntu/images/*ubuntu-xenial-16.04-amd64-server-*",
"root-device-type": "ebs"
},
"owners": ["099720109477"],
"most_recent": true
},
"instance_type": "t2.micro",
"ssh_username": "ubuntu",
"ami_name": "packer-example {{timestamp}}"
}
]
}