-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
276 additions
and
276 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,55 @@ | ||
resource "aws_db_instance" "db_instance" { | ||
identifier = var.name | ||
engine = var.engine_name | ||
engine_version = var.engine_version | ||
port = var.port | ||
db_name = var.database_name | ||
username = var.username | ||
password = var.password | ||
instance_class = var.instance_class | ||
allocated_storage = var.allocated_storage | ||
skip_final_snapshot = true | ||
license_model = var.license_model | ||
db_subnet_group_name = aws_db_subnet_group.db_subnet_group.id | ||
vpc_security_group_ids = [aws_security_group.db_instance.id] | ||
publicly_accessible = true | ||
parameter_group_name = aws_db_parameter_group.db_parameter.id | ||
option_group_name = aws_db_option_group.db_option.id | ||
|
||
tags = { | ||
Name = var.tag_id_aws | ||
} | ||
} | ||
|
||
resource "aws_db_option_group" "db_option" { | ||
name = var.name | ||
engine_name = var.engine_name | ||
major_engine_version = var.major_engine_version | ||
|
||
option { | ||
option_name = "MARIADB_AUDIT_PLUGIN" | ||
|
||
option_settings { | ||
name = "SERVER_AUDIT_EVENTS" | ||
value = "CONNECT" | ||
} | ||
} | ||
|
||
tags = { | ||
Name = var.tag_id_aws | ||
} | ||
} | ||
|
||
resource "aws_db_parameter_group" "db_parameter" { | ||
name = var.name | ||
family = var.family | ||
|
||
parameter { | ||
name = "general_log" | ||
value = "0" | ||
} | ||
|
||
tags = { | ||
Name = var.tag_id_aws | ||
} | ||
resource "aws_db_instance" "db_instance" { | ||
identifier = var.name | ||
engine = var.engine_name | ||
engine_version = var.engine_version | ||
port = var.port | ||
db_name = var.database_name | ||
username = var.username | ||
password = var.password | ||
instance_class = var.instance_class | ||
allocated_storage = var.allocated_storage | ||
skip_final_snapshot = true | ||
license_model = var.license_model | ||
db_subnet_group_name = aws_db_subnet_group.db_subnet_group.id | ||
vpc_security_group_ids = [aws_security_group.db_instance.id] | ||
publicly_accessible = true | ||
parameter_group_name = aws_db_parameter_group.db_parameter.id | ||
option_group_name = aws_db_option_group.db_option.id | ||
|
||
tags = { | ||
Name = var.tag_id_aws | ||
} | ||
} | ||
|
||
resource "aws_db_option_group" "db_option" { | ||
name = var.name | ||
engine_name = var.engine_name | ||
major_engine_version = var.major_engine_version | ||
|
||
option { | ||
option_name = "MARIADB_AUDIT_PLUGIN" | ||
|
||
option_settings { | ||
name = "SERVER_AUDIT_EVENTS" | ||
value = "CONNECT" | ||
} | ||
} | ||
|
||
tags = { | ||
Name = var.tag_id_aws | ||
} | ||
} | ||
|
||
resource "aws_db_parameter_group" "db_parameter" { | ||
name = var.name | ||
family = var.family | ||
|
||
parameter { | ||
name = "general_log" | ||
value = "0" | ||
} | ||
|
||
tags = { | ||
Name = var.tag_id_aws | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
terraform { | ||
required_version = ">= 0.12.26" | ||
|
||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = ">= 4.61.0, < 5.0.0" | ||
} | ||
} | ||
} | ||
|
||
provider "aws" { | ||
region = "us-east-1" | ||
|
||
|
||
default_tags { | ||
tags = { | ||
owner = "marco-qa" | ||
managed-by = "terraform" | ||
} | ||
} | ||
terraform { | ||
required_version = ">= 0.12.26" | ||
|
||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = ">= 4.61.0, < 5.0.0" | ||
} | ||
} | ||
} | ||
|
||
provider "aws" { | ||
region = "us-east-1" | ||
|
||
|
||
default_tags { | ||
tags = { | ||
owner = "marco-qa" | ||
managed-by = "terraform" | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
data "aws_vpc" "default" { | ||
default = true | ||
} | ||
|
||
data "aws_subnets" "all" { | ||
filter { | ||
name = "vpc-id" | ||
values = [data.aws_vpc.default.id] | ||
} | ||
} | ||
|
||
resource "aws_security_group" "db_instance" { | ||
name = var.name | ||
vpc_id = data.aws_vpc.default.id | ||
} | ||
|
||
resource "aws_security_group_rule" "allow_db_access" { | ||
type = "ingress" | ||
from_port = var.port | ||
to_port = var.port | ||
protocol = "tcp" | ||
security_group_id = aws_security_group.db_instance.id | ||
cidr_blocks = ["0.0.0.0/0"] | ||
} | ||
|
||
resource "aws_db_subnet_group" "db_subnet_group" { | ||
name = var.name | ||
subnet_ids = data.aws_subnets.all.ids | ||
|
||
tags = { | ||
Name = var.tag_id_aws | ||
} | ||
data "aws_vpc" "default" { | ||
default = true | ||
} | ||
|
||
data "aws_subnets" "all" { | ||
filter { | ||
name = "vpc-id" | ||
values = [data.aws_vpc.default.id] | ||
} | ||
} | ||
|
||
resource "aws_security_group" "db_instance" { | ||
name = var.name | ||
vpc_id = data.aws_vpc.default.id | ||
} | ||
|
||
resource "aws_security_group_rule" "allow_db_access" { | ||
type = "ingress" | ||
from_port = var.port | ||
to_port = var.port | ||
protocol = "tcp" | ||
security_group_id = aws_security_group.db_instance.id | ||
cidr_blocks = ["0.0.0.0/0"] | ||
} | ||
|
||
resource "aws_db_subnet_group" "db_subnet_group" { | ||
name = var.name | ||
subnet_ids = data.aws_subnets.all.ids | ||
|
||
tags = { | ||
Name = var.tag_id_aws | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
output "db_instance_id" { | ||
value = aws_db_instance.db_instance.id | ||
output "db_instance_id" { | ||
value = aws_db_instance.db_instance.id | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,83 +1,83 @@ | ||
variable "region" { | ||
description = "The AWS region to deploy to" | ||
type = string | ||
default = "us-east-1" | ||
} | ||
|
||
variable "username" { | ||
description = "Master username of the DB" | ||
type = string | ||
default = "marcoqadb" | ||
} | ||
|
||
variable "password" { | ||
description = "Master password of the DB" | ||
type = string | ||
default = "12345678" | ||
} | ||
|
||
variable "database_name" { | ||
description = "Name of the database to be created" | ||
type = string | ||
default = "marcoqadb123" | ||
} | ||
|
||
variable "name" { | ||
description = "Name of the database" | ||
type = string | ||
default = "dbinfraterratest123" | ||
} | ||
|
||
variable "engine_name" { | ||
description = "Name of the database engine" | ||
type = string | ||
default = "mysql" | ||
} | ||
|
||
variable "family" { | ||
description = "Family of the database" | ||
type = string | ||
default = "mysql5.7" | ||
} | ||
|
||
variable "port" { | ||
description = "Port which the database should run on" | ||
type = number | ||
default = 3306 | ||
} | ||
|
||
variable "major_engine_version" { | ||
description = "MAJOR.MINOR version of the DB engine" | ||
type = string | ||
default = "5.7" | ||
} | ||
|
||
variable "engine_version" { | ||
description = "Version of the database to be launched" | ||
default = "5.7.44" | ||
type = string | ||
} | ||
|
||
variable "allocated_storage" { | ||
description = "Disk space to be allocated to the DB instance" | ||
type = number | ||
default = 5 | ||
} | ||
|
||
variable "license_model" { | ||
description = "License model of the DB instance" | ||
type = string | ||
default = "general-public-license" | ||
} | ||
|
||
variable "instance_class" { | ||
description = "Instance class to be used to run the database" | ||
type = string | ||
default = "db.t2.micro" | ||
} | ||
|
||
variable "tag_id_aws" { | ||
description = "Tag usado na AWS" | ||
type = string | ||
default = "terraform-with-terratest" | ||
variable "region" { | ||
description = "The AWS region to deploy to" | ||
type = string | ||
default = "us-east-1" | ||
} | ||
|
||
variable "username" { | ||
description = "Master username of the DB" | ||
type = string | ||
default = "marcoqadb" | ||
} | ||
|
||
variable "password" { | ||
description = "Master password of the DB" | ||
type = string | ||
default = "12345678" | ||
} | ||
|
||
variable "database_name" { | ||
description = "Name of the database to be created" | ||
type = string | ||
default = "marcoqadb123" | ||
} | ||
|
||
variable "name" { | ||
description = "Name of the database" | ||
type = string | ||
default = "dbinfraterratest123" | ||
} | ||
|
||
variable "engine_name" { | ||
description = "Name of the database engine" | ||
type = string | ||
default = "mysql" | ||
} | ||
|
||
variable "family" { | ||
description = "Family of the database" | ||
type = string | ||
default = "mysql5.7" | ||
} | ||
|
||
variable "port" { | ||
description = "Port which the database should run on" | ||
type = number | ||
default = 3306 | ||
} | ||
|
||
variable "major_engine_version" { | ||
description = "MAJOR.MINOR version of the DB engine" | ||
type = string | ||
default = "5.7" | ||
} | ||
|
||
variable "engine_version" { | ||
description = "Version of the database to be launched" | ||
default = "5.7.44" | ||
type = string | ||
} | ||
|
||
variable "allocated_storage" { | ||
description = "Disk space to be allocated to the DB instance" | ||
type = number | ||
default = 5 | ||
} | ||
|
||
variable "license_model" { | ||
description = "License model of the DB instance" | ||
type = string | ||
default = "general-public-license" | ||
} | ||
|
||
variable "instance_class" { | ||
description = "Instance class to be used to run the database" | ||
type = string | ||
default = "db.t2.micro" | ||
} | ||
|
||
variable "tag_id_aws" { | ||
description = "Tag usado na AWS" | ||
type = string | ||
default = "terraform-with-terratest" | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.