This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
### BEGIN INIT INFO | |
# Provides: tomcat8 | |
# Required-Start: $local_fs $syslog | |
# Required-Stop: $local_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Start daemon tomcat8 at boot | |
# Description: Enable tomcat8 application server | |
### END INIT INFO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. | |
├── aws_credentials.tf # Your credentials variables. Should contain you Access key and Secret Key | |
├── aws.pem # Your Private key for access | |
├── aws.pem.pub # Your Public key | |
├── ec2 | |
│ ├── server.tf # Instance configuration, it'll be transformed into our ASG configuration | |
│ └── variables.tf | |
├── keys | |
│ ├── keys.tf # Your Key pair description on AWS | |
│ └── variables.tf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# MariaDB | |
module "database" { | |
source = "./rds" | |
sg_name = "${var.sg_name}" | |
vpc_sg_ids = "${var.vpc_sg_ids}" | |
rds_name = "${var.rds_name}" | |
db_instance_class = "${var.db_instance_class}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_db_instance" "database" { | |
identifier = "${var.rds_name}" | |
# Network configuration | |
vpc_security_group_ids = ["${var.vpc_sg_ids}"] | |
db_subnet_group_name = "${var.sg_name}" | |
# DB Engine | |
engine = "${var.db_engine}" | |
engine_version = "${var.db_engine_version}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Network & Region | |
variable "vpc_sg_ids" {} | |
variable "sg_name" {} | |
variable "db_multi_az" { default = "false" } | |
variable "public" { default = "false" } | |
# Name | |
variable "rds_name" {} | |
# Instance class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
variable "db_user" { default = "app" } | |
variable "db_password" { default = "password" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_elb" "classic_elb" { | |
name = "${var.elb_name}" | |
internal = "${var.internal}" | |
availability_zones = ["${var.availability_zone}"] | |
idle_timeout = "${var.idle_timeout}" | |
connection_draining = "${var.connection_draining}" | |
connection_draining_timeout = "${var.connection_draining_timeout}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Auto Scaling Pool | |
resource "aws_autoscaling_group" "asg" { | |
name = "${var.cluster_name}-asg" | |
availability_zones = ["${var.availability_zone}"] | |
min_size = "${var.cluster_min_size}" | |
max_size = "${var.cluster_max_size}" | |
desired_capacity = "${var.cluster_size}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. | |
├── aws_credentials.tf | |
├── aws.pem | |
├── aws.pem.pub | |
├── database_credentials.tf | |
├── ec2 | |
│ ├── cluster.tf | |
│ └── variables.tf | |
├── elb | |
│ ├── elb.tf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Database ================================================= | |
# Name | |
variable "rds_name" { default = "cluster-tut-mariadb" } | |
# Instance class | |
variable "db_instance_class" { default = "db.t2.micro" } # Free tier | |
# Storage | |
variable "db_storage" { default = 20 } # Free tier max | |
variable "db_storage_type" { default = "standard" } # Free tier |
OlderNewer