-
-
Notifications
You must be signed in to change notification settings - Fork 597
feat: DSQL Support #508
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
Merged
antonbabenko
merged 4 commits into
terraform-aws-modules:master
from
magreenbaum:feat/dsql
Jun 19, 2025
Merged
feat: DSQL Support #508
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 contains hidden or 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 @@ | ||
provider "aws" { | ||
region = local.region | ||
} | ||
|
||
provider "aws" { | ||
region = local.region2 | ||
alias = "region2" | ||
} | ||
|
||
locals { | ||
name = "ex-${basename(path.cwd)}" | ||
region = "us-east-1" | ||
region2 = "us-east-2" | ||
witness_region = "us-west-2" | ||
|
||
tags = { | ||
Example = local.name | ||
GithubRepo = "terraform-aws-rds-aurora" | ||
GithubOrg = "terraform-aws-modules" | ||
} | ||
} | ||
|
||
################################################################################ | ||
# RDS Aurora Module | ||
################################################################################ | ||
|
||
module "dsql_cluster_1" { | ||
source = "../../modules/dsql" | ||
|
||
deletion_protection_enabled = false | ||
witness_region = local.witness_region | ||
create_cluster_peering = true | ||
clusters = [module.dsql_cluster_2.arn] | ||
|
||
timeouts = { | ||
create = "1h" | ||
} | ||
|
||
tags = merge(local.tags, { Name = local.name }) | ||
} | ||
|
||
module "dsql_cluster_2" { | ||
source = "../../modules/dsql" | ||
|
||
deletion_protection_enabled = false | ||
witness_region = local.witness_region | ||
create_cluster_peering = true | ||
clusters = [module.dsql_cluster_1.arn] | ||
|
||
tags = merge(local.tags, { Name = local.name }) | ||
|
||
providers = { | ||
aws = aws.region2 | ||
} | ||
} | ||
|
||
module "dsql_single_region" { | ||
source = "../../modules/dsql" | ||
|
||
deletion_protection_enabled = false | ||
|
||
tags = merge(local.tags, { Name = "single-region" }) | ||
} |
This file contains hidden or 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,49 @@ | ||
output "dsql_cluster_1_arn" { | ||
description = "ARN of the cluster" | ||
value = module.dsql_cluster_1.arn | ||
} | ||
|
||
output "dsql_cluster_1_identifier" { | ||
description = "Cluster identifier" | ||
value = module.dsql_cluster_1.identifier | ||
} | ||
|
||
output "dsql_cluster_1_encryption_details" { | ||
description = "Encryption configuration details for the DSQL cluster" | ||
value = module.dsql_cluster_1.encryption_details | ||
} | ||
|
||
output "dsql_cluster_1_multi_region_properties" { | ||
description = "Multi-region properties of the DSQL cluster" | ||
value = module.dsql_cluster_1.multi_region_properties | ||
} | ||
|
||
output "dsql_cluster_1_vpc_endpoint_service_name" { | ||
description = "The DSQL cluster's VPC endpoint service name" | ||
value = module.dsql_cluster_1.vpc_endpoint_service_name | ||
} | ||
|
||
output "dsql_cluster_2_arn" { | ||
description = "ARN of the cluster" | ||
value = module.dsql_cluster_2.arn | ||
} | ||
|
||
output "dsql_cluster_2_identifier" { | ||
description = "Cluster identifier" | ||
value = module.dsql_cluster_2.identifier | ||
} | ||
|
||
output "dsql_cluster_2_encryption_details" { | ||
description = "Encryption configuration details for the DSQL cluster" | ||
value = module.dsql_cluster_2.encryption_details | ||
} | ||
|
||
output "dsql_cluster_2_multi_region_properties" { | ||
description = "Multi-region properties of the DSQL cluster" | ||
value = module.dsql_cluster_2.multi_region_properties | ||
} | ||
|
||
output "dsql_cluster_2_vpc_endpoint_service_name" { | ||
description = "The DSQL cluster's VPC endpoint service name" | ||
value = module.dsql_cluster_2.vpc_endpoint_service_name | ||
} |
Empty file.
This file contains hidden or 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 = ">= 1.0" | ||
|
||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = ">= 5.100" | ||
} | ||
} | ||
} |
Empty file.
This file contains hidden or 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,27 @@ | ||
resource "aws_dsql_cluster" "this" { | ||
count = var.create ? 1 : 0 | ||
|
||
deletion_protection_enabled = var.deletion_protection_enabled | ||
kms_encryption_key = var.kms_encryption_key | ||
|
||
dynamic "multi_region_properties" { | ||
for_each = var.witness_region != null ? [true] : [] | ||
content { | ||
witness_region = var.witness_region | ||
} | ||
} | ||
|
||
tags = var.tags | ||
} | ||
|
||
resource "aws_dsql_cluster_peering" "this" { | ||
count = var.create && var.create_cluster_peering ? 1 : 0 | ||
|
||
clusters = var.clusters | ||
identifier = aws_dsql_cluster.this[0].identifier | ||
witness_region = var.witness_region | ||
|
||
timeouts { | ||
create = try(var.timeouts.create, null) | ||
} | ||
} |
This file contains hidden or 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,24 @@ | ||
output "arn" { | ||
description = "ARN of the cluster" | ||
value = try(aws_dsql_cluster.this[0].arn, null) | ||
} | ||
|
||
output "identifier" { | ||
description = "Cluster identifier" | ||
value = try(aws_dsql_cluster.this[0].identifier, null) | ||
} | ||
|
||
output "encryption_details" { | ||
description = "Encryption configuration details for the DSQL cluster" | ||
value = try(aws_dsql_cluster.this[0].encryption_details, null) | ||
} | ||
|
||
output "multi_region_properties" { | ||
description = "Multi-region properties of the DSQL cluster" | ||
value = try(aws_dsql_cluster.this[0].multi_region_properties, null) | ||
} | ||
|
||
output "vpc_endpoint_service_name" { | ||
description = "The DSQL cluster's VPC endpoint service name" | ||
value = try(aws_dsql_cluster.this[0].vpc_endpoint_service_name, null) | ||
} |
This file contains hidden or 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,47 @@ | ||
variable "create" { | ||
description = "Whether cluster should be created (affects all resources)" | ||
type = bool | ||
default = true | ||
} | ||
|
||
variable "deletion_protection_enabled" { | ||
description = "Whether deletion protection is enabled in this cluster" | ||
type = bool | ||
default = null | ||
} | ||
|
||
variable "kms_encryption_key" { | ||
description = "The ARN of the AWS KMS key that encrypts data in the DSQL Cluster, or `AWS_OWNED_KMS_KEY`" | ||
type = string | ||
default = null | ||
} | ||
|
||
variable "create_cluster_peering" { | ||
description = "Whether to create cluster peering" | ||
type = bool | ||
default = false | ||
} | ||
|
||
variable "clusters" { | ||
description = "List of DSQL Cluster ARNs to be peered to this cluster" | ||
type = list(string) | ||
default = null | ||
} | ||
|
||
variable "witness_region" { | ||
description = "Witness region for the multi-region clusters. Setting this makes this cluster a multi-region cluster. Changing it recreates the cluster" | ||
type = string | ||
default = null | ||
} | ||
|
||
variable "timeouts" { | ||
description = "Create timeout configuration for the cluster" | ||
type = any | ||
default = {} | ||
} | ||
|
||
variable "tags" { | ||
description = "A map of tags to be associated with the AWS DSQL Cluster resource" | ||
type = map(string) | ||
default = {} | ||
} |
This file contains hidden or 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 = ">= 1.0" | ||
|
||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = ">= 5.100" | ||
} | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.