Skip to content
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

chore(github): add codeowner and licence documents #48

Merged
merged 4 commits into from
May 11, 2023
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
8 changes: 8 additions & 0 deletions CODEOWNER
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This is a comment.
# Each line is a file pattern followed by one or more owners.

# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,
# @global-owner1 and @global-owner2 will be requested for
# review when someone opens a pull request.
* @Young-ook
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Young-ook

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 2 additions & 0 deletions defaults.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
### default variables

locals {
default_mysql_cluster = {
engine = "aurora-mysql"
Expand Down
2 changes: 2 additions & 0 deletions label.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
### labels

resource "random_string" "iid" {
for_each = { for k, v in var.aurora_instances : k => v }
length = 5
Expand Down
38 changes: 31 additions & 7 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# amazon aurora cluster
### Amazon Aurora Cluster

# condition
### condition
locals {
enabled = (var.aurora_cluster != null ? ((length(var.aurora_cluster) > 0) ? true : false) : false)
compatibility = (local.enabled ? lookup(var.aurora_cluster, "engine", "aurora-mysql") : "aurora-mysql")
Expand All @@ -9,21 +9,45 @@ locals {
password = lookup(var.aurora_cluster, "password", random_password.password.result)
}

# security/password
### security/password
resource "random_password" "password" {
length = 16
special = true
override_special = "‘~!@#$%^*()_-+={}[],.;?':|"
}

# subnet group
### security/firewall
resource "aws_security_group" "db" {
count = local.enabled ? 1 : 0
name = format("%s", local.name)
description = format("security group for %s", local.name)
vpc_id = var.vpc
tags = merge(local.default-tags, var.tags)

ingress {
from_port = lookup(var.aurora_cluster, "port", local.default_cluster["port"])
to_port = lookup(var.aurora_cluster, "port", local.default_cluster["port"])
protocol = "tcp"
cidr_blocks = var.cidrs
self = true
}

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

### network/subnets
resource "aws_db_subnet_group" "db" {
name = format("%s-db", local.name)
subnet_ids = var.subnets
tags = merge(local.default-tags, var.tags)
}

# parameter groups
### database/parameters
resource "aws_rds_cluster_parameter_group" "db" {
name = format("%s-db-cluster-params", local.name)
tags = merge(local.default-tags, var.tags)
Expand Down Expand Up @@ -62,7 +86,7 @@ resource "aws_db_parameter_group" "db" {
}
}

# rds cluster
### database/cluster
resource "aws_rds_cluster" "db" {
cluster_identifier = local.name
engine = lookup(var.aurora_cluster, "engine", local.default_cluster.engine)
Expand Down Expand Up @@ -106,7 +130,7 @@ resource "aws_rds_cluster" "db" {
}
}

# rds instances
### database/instance
resource "aws_rds_cluster_instance" "db" {
depends_on = [aws_rds_cluster.db]
for_each = { for k, v in var.aurora_instances : k => v }
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions modules/proxy/labels.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
### labels

### frigga name
module "frigga" {
source = "Young-ook/spinnaker/aws//modules/frigga"
Expand Down
20 changes: 10 additions & 10 deletions modules/proxy/main.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
## rds proxy
### Amazon RDS Proxy

# parameters
### aws partition and region (global, gov, china)
module "aws" {
source = "Young-ook/spinnaker/aws//modules/aws-partitions"
}

### database/parameter
locals {
security_groups = var.security_groups == [] ? null : var.security_groups
debug_logging = lookup(var.proxy_config, "debug_logging", local.default_proxy_config.debug_logging)
Expand All @@ -15,20 +20,15 @@ locals {
user_password = lookup(var.auth_config, "user_password") # required
}

# aws partition and region (global, gov, china)
module "aws" {
source = "Young-ook/spinnaker/aws//modules/aws-partitions"
}

# security/secret
### security/secret
module "vault" {
source = "Young-ook/passport/aws//modules/aws-secrets"
version = "0.0.4"
name = join("-", [local.user_name, local.name])
secret = local.user_password
}

# security/policy
### security/policy
resource "aws_iam_role" "proxy" {
name = local.name
tags = merge(local.default-tags, var.tags)
Expand All @@ -49,7 +49,7 @@ resource "aws_iam_role_policy_attachment" "get-secret" {
policy_arn = module.vault.policy_arns.read
}

# proxy
### database/proxy
resource "aws_db_proxy" "proxy" {
name = local.name
tags = merge(local.default-tags, var.tags)
Expand Down
2 changes: 1 addition & 1 deletion modules/proxy/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# output variables
### output variables

output "proxy" {
description = "RDS proxy"
Expand Down
2 changes: 2 additions & 0 deletions modules/proxy/variables.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
### input variables

### network
variable "subnets" {
description = "The subnet IDs for rds"
Expand Down
11 changes: 11 additions & 0 deletions modules/proxy/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
### requirements

terraform {
required_version = ">= 1.0"
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.0"
}
}
}
23 changes: 0 additions & 23 deletions network.tf

This file was deleted.

2 changes: 1 addition & 1 deletion outputs.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# output variables
### output variables

output "cluster" {
description = "Aurora cluster"
Expand Down
2 changes: 2 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
### input variables

### network
variable "vpc" {
description = "The VPC ID to deploy the cluster"
Expand Down