-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
MSSQL: Adding two missing arguments for aws_db_instance: timezone & character_set_name #51
Merged
antonbabenko
merged 7 commits into
terraform-aws-modules:master
from
aloisbarreras:master
Apr 3, 2018
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e9dfed4
adding two missing arguments for aws_db_instance: timezone & characte…
aloisbarreras 13a4788
added character_set_name to oracle example
aloisbarreras 05812b0
added example for mssql
aloisbarreras bb4ef5e
added link to readme
aloisbarreras 8665c3d
moved tags to last line
aloisbarreras 870b3d3
fixed mssql example
aloisbarreras 95ffaf6
Added conditional mssql db_instance based on var.engine. Added condit…
aloisbarreras 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 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 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,19 @@ | ||
Complete RDS example for MSSQL Server | ||
=================================== | ||
|
||
Configuration in this directory creates set of RDS resources including DB instance, DB subnet group and DB parameter group. | ||
|
||
Data sources are used to discover existing VPC resources (VPC, subnet and security group). | ||
|
||
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. |
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 @@ | ||
provider "aws" { | ||
region = "us-west-1" | ||
} | ||
|
||
############################################################## | ||
# Data sources to get VPC, subnets and security group details | ||
############################################################## | ||
data "aws_vpc" "default" { | ||
default = true | ||
} | ||
|
||
data "aws_subnet_ids" "all" { | ||
vpc_id = "${data.aws_vpc.default.id}" | ||
} | ||
|
||
data "aws_security_group" "default" { | ||
vpc_id = "${data.aws_vpc.default.id}" | ||
name = "default" | ||
} | ||
|
||
##### | ||
# DB | ||
##### | ||
module "db" { | ||
source = "../../" | ||
|
||
identifier = "demodb" | ||
|
||
engine = "sqlserver-ex" | ||
engine_version = "14.00.1000.169.v1" | ||
instance_class = "db.t2.medium" | ||
allocated_storage = 20 | ||
storage_encrypted = false | ||
|
||
username = "demouser" | ||
|
||
password = "YourPwdShouldBeLongAndSecure!" | ||
port = "1433" | ||
|
||
vpc_security_group_ids = ["${data.aws_security_group.default.id}"] | ||
|
||
maintenance_window = "Mon:00:00-Mon:03:00" | ||
backup_window = "03:00-06:00" | ||
|
||
# disable backups to create DB faster | ||
backup_retention_period = 0 | ||
|
||
tags = { | ||
Owner = "user" | ||
Environment = "dev" | ||
} | ||
|
||
# DB subnet group | ||
subnet_ids = ["${data.aws_subnet_ids.all.ids}"] | ||
|
||
# Snapshot name upon DB deletion | ||
final_snapshot_identifier = "demodb" | ||
|
||
create_db_parameter_group = false | ||
license_model = "license-included" | ||
|
||
timezone = "Central Standard Time" | ||
} |
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,82 @@ | ||
# DB instance | ||
output "this_db_instance_address" { | ||
description = "The address of the RDS instance" | ||
value = "${module.db.this_db_instance_address}" | ||
} | ||
|
||
output "this_db_instance_arn" { | ||
description = "The ARN of the RDS instance" | ||
value = "${module.db.this_db_instance_arn}" | ||
} | ||
|
||
output "this_db_instance_availability_zone" { | ||
description = "The availability zone of the RDS instance" | ||
value = "${module.db.this_db_instance_availability_zone}" | ||
} | ||
|
||
output "this_db_instance_endpoint" { | ||
description = "The connection endpoint" | ||
value = "${module.db.this_db_instance_endpoint}" | ||
} | ||
|
||
output "this_db_instance_hosted_zone_id" { | ||
description = "The canonical hosted zone ID of the DB instance (to be used in a Route 53 Alias record)" | ||
value = "${module.db.this_db_instance_hosted_zone_id}" | ||
} | ||
|
||
output "this_db_instance_id" { | ||
description = "The RDS instance ID" | ||
value = "${module.db.this_db_instance_id}" | ||
} | ||
|
||
output "this_db_instance_resource_id" { | ||
description = "The RDS Resource ID of this instance" | ||
value = "${module.db.this_db_instance_resource_id}" | ||
} | ||
|
||
output "this_db_instance_status" { | ||
description = "The RDS instance status" | ||
value = "${module.db.this_db_instance_status}" | ||
} | ||
|
||
output "this_db_instance_name" { | ||
description = "The database name" | ||
value = "${module.db.this_db_instance_name}" | ||
} | ||
|
||
output "this_db_instance_username" { | ||
description = "The master username for the database" | ||
value = "${module.db.this_db_instance_username}" | ||
} | ||
|
||
output "this_db_instance_password" { | ||
description = "The database password (this password may be old, because Terraform doesn't track it after initial creation)" | ||
value = "${module.db.this_db_instance_password}" | ||
} | ||
|
||
output "this_db_instance_port" { | ||
description = "The database port" | ||
value = "${module.db.this_db_instance_port}" | ||
} | ||
|
||
# DB subnet group | ||
output "this_db_subnet_group_id" { | ||
description = "The db subnet group name" | ||
value = "${module.db.this_db_subnet_group_id}" | ||
} | ||
|
||
output "this_db_subnet_group_arn" { | ||
description = "The ARN of the db subnet group" | ||
value = "${module.db.this_db_subnet_group_arn}" | ||
} | ||
|
||
# DB parameter group | ||
output "this_db_parameter_group_id" { | ||
description = "The db parameter group id" | ||
value = "${module.db.this_db_parameter_group_id}" | ||
} | ||
|
||
output "this_db_parameter_group_arn" { | ||
description = "The ARN of the db parameter group" | ||
value = "${module.db.this_db_parameter_group_arn}" | ||
} |
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 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 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 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 |
---|---|---|
@@ -1,60 +1,75 @@ | ||
locals { | ||
this_db_instance_address = "${local.is_mssql ? element(concat(aws_db_instance.this_mssql.*.address, list("")), 0) : element(concat(aws_db_instance.this.*.address, list("")), 0)}" | ||
this_db_instance_arn = "${local.is_mssql ? element(concat(aws_db_instance.this_mssql.*.arn, list("")), 0) : element(concat(aws_db_instance.this.*.arn, list("")), 0)}" | ||
this_db_instance_availability_zone = "${local.is_mssql ? element(concat(aws_db_instance.this_mssql.*.availability_zone, list("")), 0) : element(concat(aws_db_instance.this.*.availability_zone, list("")), 0)}" | ||
this_db_instance_endpoint = "${local.is_mssql ? element(concat(aws_db_instance.this_mssql.*.endpoint, list("")), 0) : element(concat(aws_db_instance.this.*.endpoint, list("")), 0)}" | ||
this_db_instance_hosted_zone_id = "${local.is_mssql ? element(concat(aws_db_instance.this_mssql.*.hosted_zone_id, list("")), 0) : element(concat(aws_db_instance.this.*.hosted_zone_id, list("")), 0)}" | ||
this_db_instance_id = "${local.is_mssql ? element(concat(aws_db_instance.this_mssql.*.id, list("")), 0) : element(concat(aws_db_instance.this.*.id, list("")), 0)}" | ||
this_db_instance_resource_id = "${local.is_mssql ? element(concat(aws_db_instance.this_mssql.*.resource_id, list("")), 0) : element(concat(aws_db_instance.this.*.resource_id, list("")), 0)}" | ||
this_db_instance_status = "${local.is_mssql ? element(concat(aws_db_instance.this_mssql.*.status, list("")), 0) : element(concat(aws_db_instance.this.*.status, list("")), 0)}" | ||
this_db_instance_name = "${local.is_mssql ? element(concat(aws_db_instance.this_mssql.*.name, list("")), 0) : element(concat(aws_db_instance.this.*.name, list("")), 0)}" | ||
this_db_instance_username = "${local.is_mssql ? element(concat(aws_db_instance.this_mssql.*.username, list("")), 0) : element(concat(aws_db_instance.this.*.username, list("")), 0)}" | ||
this_db_instance_password = "${local.is_mssql ? element(concat(aws_db_instance.this_mssql.*.password, list("")), 0) : element(concat(aws_db_instance.this.*.password, list("")), 0)}" | ||
this_db_instance_port = "${local.is_mssql ? element(concat(aws_db_instance.this_mssql.*.port, list("")), 0) : element(concat(aws_db_instance.this.*.port, list("")), 0)}" | ||
} | ||
|
||
# DB instance | ||
output "this_db_instance_address" { | ||
description = "The address of the RDS instance" | ||
value = "${element(concat(aws_db_instance.this.*.address, list("")), 0)}" | ||
value = "${local.this_db_instance_address}" | ||
} | ||
|
||
output "this_db_instance_arn" { | ||
description = "The ARN of the RDS instance" | ||
value = "${element(concat(aws_db_instance.this.*.arn, list("")), 0)}" | ||
value = "${local.this_db_instance_arn}" | ||
} | ||
|
||
output "this_db_instance_availability_zone" { | ||
description = "The availability zone of the RDS instance" | ||
value = "${element(concat(aws_db_instance.this.*.availability_zone, list("")), 0)}" | ||
value = "${local.this_db_instance_availability_zone}" | ||
} | ||
|
||
output "this_db_instance_endpoint" { | ||
description = "The connection endpoint" | ||
value = "${element(concat(aws_db_instance.this.*.endpoint, list("")), 0)}" | ||
value = "${local.this_db_instance_endpoint}" | ||
} | ||
|
||
output "this_db_instance_hosted_zone_id" { | ||
description = "The canonical hosted zone ID of the DB instance (to be used in a Route 53 Alias record)" | ||
value = "${element(concat(aws_db_instance.this.*.hosted_zone_id, list("")), 0)}" | ||
value = "${local.this_db_instance_hosted_zone_id}" | ||
} | ||
|
||
output "this_db_instance_id" { | ||
description = "The RDS instance ID" | ||
value = "${element(concat(aws_db_instance.this.*.id, list("")), 0)}" | ||
value = "${local.this_db_instance_id}" | ||
} | ||
|
||
output "this_db_instance_resource_id" { | ||
description = "The RDS Resource ID of this instance" | ||
value = "${element(concat(aws_db_instance.this.*.resource_id, list("")), 0)}" | ||
value = "${local.this_db_instance_resource_id}" | ||
} | ||
|
||
output "this_db_instance_status" { | ||
description = "The RDS instance status" | ||
value = "${element(concat(aws_db_instance.this.*.status, list("")), 0)}" | ||
value = "${local.this_db_instance_status}" | ||
} | ||
|
||
output "this_db_instance_name" { | ||
description = "The database name" | ||
value = "${element(concat(aws_db_instance.this.*.name, list("")), 0)}" | ||
value = "${local.this_db_instance_name}" | ||
} | ||
|
||
output "this_db_instance_username" { | ||
description = "The master username for the database" | ||
value = "${element(concat(aws_db_instance.this.*.username, list("")), 0)}" | ||
value = "${local.this_db_instance_username}" | ||
} | ||
|
||
output "this_db_instance_password" { | ||
description = "The database password (this password may be old, because Terraform doesn't track it after initial creation)" | ||
value = "${var.password}" | ||
value = "${local.this_db_instance_password}" | ||
} | ||
|
||
output "this_db_instance_port" { | ||
description = "The database port" | ||
value = "${element(concat(aws_db_instance.this.*.port, list("")), 0)}" | ||
value = "${local.this_db_instance_port}" | ||
} |
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 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
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.
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.
Isn't character_set_name also supported in mssql?
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.
@antonbabenko actually looking at the docs, character_set_name only applies to Oracle instances. I'll go ahead and remove this line.
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.
Well never mind actually. It doesn't break deploying like timezone does, so it seems safe to leave it in.