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: split rds res def #15

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
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ The following resources are included:
* [iam-policy/sqs](./humanitec-resource-defs/iam-policy/sqs): IAM policy for an SQS queue.
* [iam-role/service-account](./humanitec-resource-defs/iam-role/service-account): An assumable IAM role, by a k8s service account.
* [k8s/service-account](./humanitec-resource-defs/k8s/service-account): A `k8s-service-account` linked to an IAM role.
* [rds/aurora](./humanitec-resource-defs/rds/aurora): A `postgres` or `mysql` resource using AWS RDS Aurora.
* [rds/basic](./humanitec-resource-defs/rds/basic): A `postgres` or `mysql` resource using AWS RDS.
* [mysql/aurora](./humanitec-resource-defs/rds/aurora): A `mysql` resource using AWS RDS Aurora.
* [mysql/basic](./humanitec-resource-defs/rds/basic): A `mysql` resource using AWS RDS.
* [postgres/aurora](./humanitec-resource-defs/rds/aurora): A `postgres` resource using AWS RDS Aurora.
* [postgres/basic](./humanitec-resource-defs/rds/basic): A `postgres` resource using AWS RDS.
* [redis/basic](./humanitec-resource-defs/redis/basic): A `redis` resource using AWS ElastiCache.
* [s3/basic](./humanitec-resource-defs/s3/basic): A basic `s3` bucket.
* [sqs/basic](./humanitec-resource-defs/sqs/basic): A basic `sqs` queue.
Expand Down
4 changes: 2 additions & 2 deletions examples/mysql/aurora/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ resources:

| Name | Source | Version |
|------|--------|---------|
| rds | ../../../humanitec-resource-defs/rds/aurora | n/a |
| mysql | ../../../humanitec-resource-defs/mysql/aurora | n/a |

## Resources

| Name | Type |
|------|------|
| [humanitec_application.app](https://registry.terraform.io/providers/humanitec/humanitec/latest/docs/resources/application) | resource |
| [humanitec_resource_definition_criteria.rds](https://registry.terraform.io/providers/humanitec/humanitec/latest/docs/resources/resource_definition_criteria) | resource |
| [humanitec_resource_definition_criteria.mysql](https://registry.terraform.io/providers/humanitec/humanitec/latest/docs/resources/resource_definition_criteria) | resource |

## Inputs

Expand Down
14 changes: 4 additions & 10 deletions examples/mysql/aurora/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ resource "humanitec_application" "app" {
name = var.name
}

module "rds" {
source = "../../../humanitec-resource-defs/rds/aurora"
module "mysql" {
source = "../../../humanitec-resource-defs/mysql/aurora"

prefix = "${var.name}-"
resource_packs_aws_rev = var.resource_packs_aws_rev
Expand All @@ -14,12 +14,6 @@ module "rds" {
secret_key = var.secret_key
region = var.region

type = "mysql"

engine = "aurora-mysql"
engine_version = "8.0"
group_family = "aurora-mysql8.0"

name = "${var.name}-database"
database_name = "my_database"
master_username = "username"
Expand All @@ -36,7 +30,7 @@ module "rds" {
}
}

resource "humanitec_resource_definition_criteria" "rds" {
resource_definition_id = module.rds.id
resource "humanitec_resource_definition_criteria" "mysql" {
resource_definition_id = module.mysql.id
app_id = humanitec_application.app.id
}
4 changes: 2 additions & 2 deletions examples/mysql/basic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ resources:

| Name | Source | Version |
|------|--------|---------|
| rds | ../../../humanitec-resource-defs/rds/basic | n/a |
| mysql | ../../../humanitec-resource-defs/mysql/basic | n/a |

## Resources

Expand All @@ -40,7 +40,7 @@ resources:
| [aws_security_group.mysql](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group) | resource |
| [aws_vpc_security_group_ingress_rule.k8s_node_mysql](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_security_group_ingress_rule) | resource |
| [humanitec_application.app](https://registry.terraform.io/providers/humanitec/humanitec/latest/docs/resources/application) | resource |
| [humanitec_resource_definition_criteria.rds](https://registry.terraform.io/providers/humanitec/humanitec/latest/docs/resources/resource_definition_criteria) | resource |
| [humanitec_resource_definition_criteria.mysql](https://registry.terraform.io/providers/humanitec/humanitec/latest/docs/resources/resource_definition_criteria) | resource |

## Inputs

Expand Down
18 changes: 6 additions & 12 deletions examples/mysql/basic/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ resource "humanitec_application" "app" {
name = var.name
}

module "rds" {
source = "../../../humanitec-resource-defs/rds/basic"
module "mysql" {
source = "../../../humanitec-resource-defs/mysql/basic"

prefix = "${var.name}-"
resource_packs_aws_rev = var.resource_packs_aws_rev
Expand All @@ -19,21 +19,15 @@ module "rds" {
username = "username"
password = "password"

type = "mysql"
engine = "mysql"
engine_version = "8.0"
group_family = "mysql8.0"
major_engine_version = "8.0"

create_db_subnet_group = true
db_subnet_group_name = "${var.name}-subnet-group"
subnet_ids = var.subnet_ids

vpc_security_group_ids = [aws_security_group.mysql.id]
}

resource "humanitec_resource_definition_criteria" "rds" {
resource_definition_id = module.rds.id
resource "humanitec_resource_definition_criteria" "mysql" {
resource_definition_id = module.mysql.id
app_id = humanitec_application.app.id
}

Expand All @@ -47,7 +41,7 @@ resource "aws_vpc_security_group_ingress_rule" "k8s_node_mysql" {
security_group_id = aws_security_group.mysql.id

referenced_security_group_id = var.k8s_node_security_group_id
from_port = 5432
from_port = 3306
ip_protocol = "tcp"
to_port = 5432
to_port = 3306
}
4 changes: 2 additions & 2 deletions examples/postgres/aurora/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ resources:

| Name | Source | Version |
|------|--------|---------|
| rds | ../../../humanitec-resource-defs/rds/aurora | n/a |
| postgres | ../../../humanitec-resource-defs/postgres/aurora | n/a |

## Resources

| Name | Type |
|------|------|
| [humanitec_application.app](https://registry.terraform.io/providers/humanitec/humanitec/latest/docs/resources/application) | resource |
| [humanitec_resource_definition_criteria.rds](https://registry.terraform.io/providers/humanitec/humanitec/latest/docs/resources/resource_definition_criteria) | resource |
| [humanitec_resource_definition_criteria.postgres](https://registry.terraform.io/providers/humanitec/humanitec/latest/docs/resources/resource_definition_criteria) | resource |

## Inputs

Expand Down
8 changes: 4 additions & 4 deletions examples/postgres/aurora/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ resource "humanitec_application" "app" {
name = var.name
}

module "rds" {
source = "../../../humanitec-resource-defs/rds/aurora"
module "postgres" {
source = "../../../humanitec-resource-defs/postgres/aurora"

prefix = "${var.name}-"
resource_packs_aws_rev = var.resource_packs_aws_rev
Expand All @@ -30,7 +30,7 @@ module "rds" {
}
}

resource "humanitec_resource_definition_criteria" "rds" {
resource_definition_id = module.rds.id
resource "humanitec_resource_definition_criteria" "postgres" {
resource_definition_id = module.postgres.id
app_id = humanitec_application.app.id
}
4 changes: 2 additions & 2 deletions examples/postgres/basic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ resources:

| Name | Source | Version |
|------|--------|---------|
| rds | ../../../humanitec-resource-defs/rds/basic | n/a |
| postgres | ../../../humanitec-resource-defs/postgres/basic | n/a |

## Resources

Expand All @@ -40,7 +40,7 @@ resources:
| [aws_security_group.postgres](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group) | resource |
| [aws_vpc_security_group_ingress_rule.k8s_node_postgres](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_security_group_ingress_rule) | resource |
| [humanitec_application.app](https://registry.terraform.io/providers/humanitec/humanitec/latest/docs/resources/application) | resource |
| [humanitec_resource_definition_criteria.rds](https://registry.terraform.io/providers/humanitec/humanitec/latest/docs/resources/resource_definition_criteria) | resource |
| [humanitec_resource_definition_criteria.postgres](https://registry.terraform.io/providers/humanitec/humanitec/latest/docs/resources/resource_definition_criteria) | resource |

## Inputs

Expand Down
9 changes: 4 additions & 5 deletions examples/postgres/basic/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ resource "humanitec_application" "app" {
name = var.name
}

module "rds" {
source = "../../../humanitec-resource-defs/rds/basic"
module "postgres" {
source = "../../../humanitec-resource-defs/postgres/basic"

prefix = "${var.name}-"
resource_packs_aws_rev = var.resource_packs_aws_rev
Expand All @@ -26,8 +26,8 @@ module "rds" {
vpc_security_group_ids = [aws_security_group.postgres.id]
}

resource "humanitec_resource_definition_criteria" "rds" {
resource_definition_id = module.rds.id
resource "humanitec_resource_definition_criteria" "postgres" {
resource_definition_id = module.postgres.id
app_id = humanitec_application.app.id
}

Expand All @@ -45,4 +45,3 @@ resource "aws_vpc_security_group_ingress_rule" "k8s_node_postgres" {
ip_protocol = "tcp"
to_port = 5432
}

63 changes: 63 additions & 0 deletions humanitec-resource-defs/mysql/aurora/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<!-- BEGIN_TF_DOCS -->
## Requirements

| Name | Version |
|------|---------|
| terraform | >= 1.3.0 |
| humanitec | ~> 0 |

## Providers

| Name | Version |
|------|---------|
| humanitec | ~> 0 |

## Resources

| Name | Type |
|------|------|
| [humanitec_resource_definition.main](https://registry.terraform.io/providers/humanitec/humanitec/latest/docs/resources/resource_definition) | resource |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| access\_key | n/a | `string` | n/a | yes |
| database\_name | n/a | `string` | n/a | yes |
| db\_subnet\_group\_name | n/a | `string` | n/a | yes |
| master\_password | n/a | `string` | n/a | yes |
| master\_username | n/a | `string` | n/a | yes |
| name | n/a | `string` | n/a | yes |
| prefix | n/a | `string` | n/a | yes |
| region | n/a | `string` | n/a | yes |
| resource\_packs\_aws\_rev | AWS Resource Pack git branch | `string` | n/a | yes |
| secret\_key | n/a | `string` | n/a | yes |
| subnets | n/a | `set(string)` | n/a | yes |
| vpc | n/a | `string` | n/a | yes |
| apply\_immediately | n/a | `bool` | `true` | no |
| create\_cloudwatch\_log\_group | n/a | `bool` | `false` | no |
| create\_db\_cluster\_activity\_stream | n/a | `bool` | `false` | no |
| create\_db\_subnet\_group | n/a | `bool` | `true` | no |
| db\_cluster\_activity\_stream\_kms\_key\_id | n/a | `string` | `null` | no |
| db\_cluster\_activity\_stream\_mode | n/a | `string` | `"async"` | no |
| db\_cluster\_parameter\_group\_parameters | n/a | `set(any)` | `[]` | no |
| db\_parameter\_group\_parameters | n/a | `set(any)` | `[]` | no |
| enabled\_cloudwatch\_logs\_exports | n/a | `set(string)` | `[]` | no |
| endpoints | n/a | `any` | `{}` | no |
| engine | n/a | `string` | `"aurora-mysql"` | no |
| engine\_version | n/a | `string` | `"8.0"` | no |
| group\_family | n/a | `string` | `"aurora-mysql8.0"` | no |
| instances | n/a | `map(any)` | <pre>{<br> "1": {<br> "db_parameter_group_name": "default.aurora-mysql8.0",<br> "instance_class": "db.r5.2xlarge",<br> "publicly_accessible": true<br> },<br> "2": {<br> "identifier": "static-member-1",<br> "instance_class": "db.r5.2xlarge"<br> }<br>}</pre> | no |
| resource\_packs\_aws\_url | AWS Resource Pack git url | `string` | `"https://github.com/humanitec-architecture/resource-packs-aws.git"` | no |
| security\_group\_rules | n/a | `any` | `{}` | no |
| skip\_final\_snapshot | n/a | `bool` | `true` | no |
| storage\_encrypted | n/a | `bool` | `true` | no |
| storage\_type | n/a | `string` | `"aurora"` | no |
| type | n/a | `string` | `"mysql"` | no |

## Outputs

| Name | Description |
|------|-------------|
| id | n/a |
<!-- END_TF_DOCS -->
47 changes: 47 additions & 0 deletions humanitec-resource-defs/mysql/aurora/terraform.tfvars.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
access_key = ""
apply_immediately = true
create_cloudwatch_log_group = false
create_db_cluster_activity_stream = false
create_db_subnet_group = true
database_name = ""
db_cluster_activity_stream_kms_key_id = ""
db_cluster_activity_stream_mode = "async"
db_cluster_parameter_group_parameters = []
db_parameter_group_parameters = []
db_subnet_group_name = ""
enabled_cloudwatch_logs_exports = []
endpoints = {}
engine = "aurora-mysql"
engine_version = "8.0"
group_family = "aurora-mysql8.0"
instances = {
"1": {
"db_parameter_group_name": "default.aurora-mysql8.0",
"instance_class": "db.r5.2xlarge",
"publicly_accessible": true
},
"2": {
"identifier": "static-member-1",
"instance_class": "db.r5.2xlarge"
}
}
master_password = ""
master_username = ""
name = ""
prefix = ""
region = ""

# AWS Resource Pack git branch
resource_packs_aws_rev = ""

# AWS Resource Pack git url
resource_packs_aws_url = "https://github.com/humanitec-architecture/resource-packs-aws.git"

secret_key = ""
security_group_rules = {}
skip_final_snapshot = true
storage_encrypted = true
storage_type = "aurora"
subnets = ""
type = "mysql"
vpc = ""
Loading
Loading