-
-
Notifications
You must be signed in to change notification settings - Fork 574
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update examples to to be self-sufficient and using latest prac…
…tices/versions (#200)
- Loading branch information
1 parent
24b3539
commit e859489
Showing
28 changed files
with
912 additions
and
412 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -27,3 +27,6 @@ override.tf.json | |
# Ignore CLI configuration files | ||
.terraformrc | ||
terraform.rc | ||
|
||
# S3 import example | ||
backup |
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Autoscaling Example | ||
|
||
Configuration in this directory creates an Aurora cluster with autoscaling enabled. | ||
|
||
## Usage | ||
|
||
To run this example you need to execute: | ||
|
||
```bash | ||
$ terraform init | ||
$ terraform plan | ||
$ terraform apply | ||
``` | ||
|
||
Note that this example may create resources which cost money. Run `terraform destroy` when you don't need these resources. | ||
|
||
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||
## Requirements | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| terraform | >= 0.12.26 | | ||
| aws | >= 3.8 | | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| aws | >= 3.8 | | ||
|
||
## Modules | ||
|
||
| Name | Source | Version | | ||
|------|--------|---------| | ||
| aurora | ../../ | | | ||
| disabled_aurora | ../../ | | | ||
| vpc | terraform-aws-modules/vpc/aws | ~> 2 | | ||
|
||
## Resources | ||
|
||
| Name | | ||
|------| | ||
| [aws_db_parameter_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/db_parameter_group) | | ||
| [aws_rds_cluster_parameter_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/rds_cluster_parameter_group) | | ||
|
||
## Inputs | ||
|
||
No input. | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| this\_rds\_cluster\_database\_name | Name for an automatically created database on cluster creation | | ||
| this\_rds\_cluster\_endpoint | The cluster endpoint | | ||
| this\_rds\_cluster\_id | The ID of the cluster | | ||
| this\_rds\_cluster\_instance\_endpoints | A list of all cluster instance endpoints | | ||
| this\_rds\_cluster\_instance\_ids | A list of all cluster instance ids | | ||
| this\_rds\_cluster\_master\_password | The master password | | ||
| this\_rds\_cluster\_master\_username | The master username | | ||
| this\_rds\_cluster\_port | The port | | ||
| this\_rds\_cluster\_reader\_endpoint | The cluster reader endpoint | | ||
| this\_rds\_cluster\_resource\_id | The Resource ID of the cluster | | ||
| this\_security\_group\_id | The security group ID of the cluster | | ||
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
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 |
---|---|---|
@@ -0,0 +1,86 @@ | ||
provider "aws" { | ||
region = local.region | ||
} | ||
|
||
locals { | ||
name = "advanced" | ||
region = "eu-west-1" | ||
tags = { | ||
Owner = "user" | ||
Environment = "dev" | ||
} | ||
} | ||
|
||
################################################################################ | ||
# Supporting Resources | ||
################################################################################ | ||
|
||
module "vpc" { | ||
source = "terraform-aws-modules/vpc/aws" | ||
version = "~> 2" | ||
|
||
name = local.name | ||
cidr = "10.99.0.0/18" | ||
|
||
azs = ["${local.region}a", "${local.region}b", "${local.region}c"] | ||
public_subnets = ["10.99.0.0/24", "10.99.1.0/24", "10.99.2.0/24"] | ||
private_subnets = ["10.99.3.0/24", "10.99.4.0/24", "10.99.5.0/24"] | ||
database_subnets = ["10.99.7.0/24", "10.99.8.0/24", "10.99.9.0/24"] | ||
|
||
tags = local.tags | ||
} | ||
|
||
################################################################################ | ||
# RDS Aurora Module | ||
################################################################################ | ||
|
||
module "aurora" { | ||
source = "../../" | ||
|
||
name = local.name | ||
engine = "aurora-postgresql" | ||
engine_version = "11.9" | ||
instance_type = "db.r5.large" | ||
instance_type_replica = "db.t3.large" | ||
|
||
vpc_id = module.vpc.vpc_id | ||
db_subnet_group_name = module.vpc.database_subnet_group_name | ||
create_security_group = true | ||
allowed_cidr_blocks = module.vpc.private_subnets_cidr_blocks | ||
|
||
replica_count = 1 | ||
replica_scale_enabled = true | ||
replica_scale_min = 1 | ||
replica_scale_max = 5 | ||
|
||
monitoring_interval = 60 | ||
|
||
apply_immediately = true | ||
skip_final_snapshot = true | ||
|
||
db_parameter_group_name = aws_db_parameter_group.example.id | ||
db_cluster_parameter_group_name = aws_rds_cluster_parameter_group.example.id | ||
enabled_cloudwatch_logs_exports = ["postgresql"] | ||
|
||
tags = local.tags | ||
} | ||
|
||
resource "aws_db_parameter_group" "example" { | ||
name_prefix = "${local.name}-aurora-db-postgres11-parameter-group" | ||
family = "aurora-postgresql11" | ||
description = "${local.name}-aurora-db-postgres11-parameter-group" | ||
tags = local.tags | ||
} | ||
|
||
resource "aws_rds_cluster_parameter_group" "example" { | ||
name_prefix = "${local.name}-aurora-postgres11-cluster-parameter-group" | ||
family = "aurora-postgresql11" | ||
description = "${local.name}-aurora-postgres11-cluster-parameter-group" | ||
tags = local.tags | ||
} | ||
|
||
module "disabled_aurora" { | ||
source = "../../" | ||
|
||
create_cluster = false | ||
} |
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
terraform { | ||
required_version = ">= 0.12.26" | ||
|
||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = ">= 3.8" | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Custom Instance Settings Example | ||
|
||
Configuration in this directory creates an Aurora cluster with multiple replicas configured through custom settings. | ||
|
||
## Usage | ||
|
||
To run this example you need to execute: | ||
|
||
```bash | ||
$ terraform init | ||
$ terraform plan | ||
$ terraform apply | ||
``` | ||
|
||
Note that this example may create resources which cost money. Run `terraform destroy` when you don't need these resources. | ||
|
||
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||
## Requirements | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| terraform | >= 0.12.26 | | ||
| aws | >= 3.8 | | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| aws | >= 3.8 | | ||
|
||
## Modules | ||
|
||
| Name | Source | Version | | ||
|------|--------|---------| | ||
| aurora | ../../ | | | ||
| vpc | terraform-aws-modules/vpc/aws | ~> 2 | | ||
|
||
## Resources | ||
|
||
| Name | | ||
|------| | ||
| [aws_db_parameter_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/db_parameter_group) | | ||
| [aws_rds_cluster_parameter_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/rds_cluster_parameter_group) | | ||
|
||
## Inputs | ||
|
||
No input. | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| this\_rds\_cluster\_database\_name | Name for an automatically created database on cluster creation | | ||
| this\_rds\_cluster\_endpoint | The cluster endpoint | | ||
| this\_rds\_cluster\_id | The ID of the cluster | | ||
| this\_rds\_cluster\_instance\_endpoints | A list of all cluster instance endpoints | | ||
| this\_rds\_cluster\_master\_password | The master password | | ||
| this\_rds\_cluster\_master\_username | The master username | | ||
| this\_rds\_cluster\_port | The port | | ||
| this\_rds\_cluster\_reader\_endpoint | The cluster reader endpoint | | ||
| this\_rds\_cluster\_resource\_id | The Resource ID of the cluster | | ||
| this\_security\_group\_id | The security group ID of the cluster | | ||
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
Oops, something went wrong.