-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IaC - RDS DB #36
IaC - RDS DB #36
Conversation
terraform/rds.tf
Outdated
availability_zones = ["ap-southeast-2a", "ap-southeast-2b"] | ||
engine = "aurora-mysql" | ||
engine_version = "5.7.12" | ||
engine_mode = "serverless" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can remove this line
terraform/variables.tf
Outdated
variable "rds_master_password" { | ||
default = "thisisasecurepassword" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please, dont have your db password in the code... 🗡️
terraform/rds.tf
Outdated
database_name = "wpdb" | ||
availability_zones = ["ap-southeast-2a", "ap-southeast-2b"] | ||
engine = "aurora-mysql" | ||
engine_version = "5.7.12" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use this command to check versions available:
aws rds describe-db-engine-versions --engine aurora-mysql --query "DBEngineVersions[].EngineVersion"
terraform/sg.tf
Outdated
resource "aws_security_group" "wordpress-access" { | ||
name = "wordpress-access" | ||
description = "Allow inbound traffic to Wordpress Instance" | ||
vpc_id = "${aws_vpc.da-wordpress-vpc.id}" | ||
|
||
tags = { | ||
Name = "wordpress-access" | ||
} | ||
ingress { | ||
from_port = 443 | ||
to_port = 443 | ||
protocol = "tcp" | ||
cidr_blocks = ["0.0.0.0/0"] | ||
} | ||
egress { | ||
from_port = 0 | ||
to_port = 0 | ||
protocol = "-1" | ||
cidr_blocks = ["0.0.0.0/0"] | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should not be here.. should be part of the LB card
terraform/rds.tf
Outdated
|
||
cluster_identifier = "wp-db" | ||
database_name = "wpdb" | ||
availability_zones = ["ap-southeast-2a", "ap-southeast-2b"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be a variable to be used both here and n the VPC
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey Kiko,
I initally wanted to use
data "aws_availability_zones" "iac-azs" { state = "available" }
From the VPC.
But when trying, I recieved an error that the RDS Cluster didn't support ap-southeast-2c
So I manually entered these two.
I can create a list variable with 2a / 2b inside but it won't be the same as the VPC
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data "aws_availability_zones" "iac-azs" { state = "available" }
is not the best way to define where your resources will run, because depending on what you're doing, a resource running on a specific AZ will not be able to be used by another resource running on other AZ and by doing this way, you don;t have control on where things are running.
Ideally you should have a variable(which you already have) that will contain the AZs that you want to deploy your resources. You can have a default value for this variable, so you don't need to add it to every resource you create.
RDS DB Code v0.3- Made changes to the RDS File. - Added Output File for PasswordPlease test and advise |
few comments not resolved yet. Also, you have a conflict in the variables file that needs to be solved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
RDS DB Code
Within this code, I've made a few changes when compared to my first revision of the RDS Code.
It contains 3 files.
SG.tf
- Here I have placed the relevant Security groups that will connect the DB to the VPC and to the resources we have created. There will many many additions to this file as the solution evolves.variables.tf
- Using the existing variables file, I've added a few entries with regards to the DB Cluster Creation.RDS.tf
- So here, I've added additional resources to help with the DB creation under the guidance of Kiko. What added now areIt will create in the following AZ's (ap-southeast-2a /b)
Running Serverless engine version 5.7.12
To run this please clone the repo and run
terraform init
terraform plan
terraform apply
Unfortunately there is a bug upon creation.
Terraform advised the following during the apply phase
Error: error creating RDS cluster: InvalidParameterValue: The engine mode serverless you requested is currently unavailable.
status code: 400, request id: 8596d824-df61-4457-9338-33cf4c0752be
hashicorp/terraform-provider-aws#5593
Git Issue #5593 on Terraform repo advises that this issue may be with serverless requiring a specific engine when running.
As per Kiko's instruction located here
#14
Adding
Aurora (MySQL 5.7) 2.07.2
Doesn't seem to work either.
Please let me know your thoughts regarding this Team!