Single instance, external DB

eb create --single
This commit is contained in:
2020-07-30 00:42:23 +01:00
parent e860a4557c
commit cae918f832
5 changed files with 75 additions and 28 deletions

View File

@@ -13,13 +13,6 @@ locals {
}
}
# Name
module "name" {
source = "git::"
}
# Network
module "vpc" {
@@ -54,7 +47,7 @@ resource "aws_security_group" "ec2_security_group" {
from_port = 80
to_port = 80
protocol = "tcp"
cidr_blocks = [module.vpc.vpc_cidr_block]
cidr_blocks = ["0.0.0.0/0"]
}
ingress {
@@ -62,7 +55,15 @@ resource "aws_security_group" "ec2_security_group" {
from_port = 443
to_port = 443
protocol = "tcp"
cidr_blocks = [module.vpc.vpc_cidr_block]
cidr_blocks = ["0.0.0.0/0"]
}
egress {
description = "Outbound to all"
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
}
@@ -73,16 +74,16 @@ module "rds_instance" {
stage = var.stage
name = var.name
allocated_storage = 5
database_name = "postgres"
database_user = "mainuser"
database_password = "password"
database_port = 5432
db_parameter_group = "postgres12"
engine = "postgres"
engine_version = "12.3"
instance_class = "db.t2.micro"
# security_group_ids =
allocated_storage = 5
database_name = "postgres"
database_user = "mainuser"
database_password = "password"
database_port = 5432
db_parameter_group = "postgres12"
engine = "postgres"
engine_version = "12.3"
instance_class = "db.t2.micro"
security_group_ids = [aws_security_group.ec2_security_group.id]
subnet_ids = module.subnets.public_subnet_ids
vpc_id = module.vpc.vpc_id
publicly_accessible = true
@@ -92,7 +93,7 @@ module "rds_instance" {
# S3 bucket
resource "aws_s3_bucket" "static_assets" {
bucket = "${var.stage}-${var.name}-strapi_uploads"
bucket = "${var.stage}-${var.name}-strapi-uploads"
acl = "private"
tags = local.tags
}

View File

@@ -1,12 +1,17 @@
# S3
output "s3_static_assets" {
value = "resource.aws_s3_bucket.static_assets.id"
output "s3_static_assets_id" {
value = resource.aws_s3_bucket.static_assets.id
description = "Name of the static assets S3 bucket."
}
output "s3_static_assets" {
value = "resource.aws_s3_bucket.static_assets.arn"
output "s3_static_assets_arn" {
value = resource.aws_s3_bucket.static_assets.arn
description = "ARN of the static assets S3 bucket."
}
# Security groups
output "aws_security_group_ec2_security_group" {
value = aws_security_group.ec2_security_group.id
description = "Security group for the EC2 instances applied by the Elastic Scaler."
}