-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from ministryofjustice/bugfix/providers-outsid…
…e-module split main and rds example, took providers out of module
- Loading branch information
Showing
5 changed files
with
73 additions
and
64 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 |
---|---|---|
|
@@ -29,7 +29,11 @@ module "example_team_rds" { | |
is-production = "false" | ||
environment-name = "development" | ||
infrastructure-support = "[email protected]" | ||
aws_region = "eu-west-2" | ||
providers = { | ||
# This can be either "aws.london" or "aws.ireland: | ||
aws = "aws.london" | ||
} | ||
} | ||
``` | ||
|
@@ -49,8 +53,8 @@ module "example_team_rds" { | |
| snapshot_identifier | Specifies whether or not to create this database from a snapshot. This correlates to the snapshot ID you'd find in the RDS console. | string | | no | | ||
| cluster_name | The name of the cluster (eg.: cloud-platform-live-0) | string | - | yes | | ||
| cluster_state_bucket | The name of the S3 bucket holding the terraform state for the cluster | string | - | yes | | ||
| aws_region | region into which the resource will be created | string | eu-west-2 | no | ||
|
||
| providers | provider (and region) creating the resources | arrays of string | default provider | no | ||
| | ||
|
||
### Tags | ||
|
||
|
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 |
---|---|---|
|
@@ -3,56 +3,15 @@ terraform { | |
} | ||
|
||
provider "aws" { | ||
region = "eu-west-1" | ||
region = "eu-west-2" | ||
} | ||
|
||
/* | ||
* When using this module through the cloud-platform-environments, the following | ||
* two variables are automatically supplied by the pipeline. | ||
* | ||
*/ | ||
|
||
variable "cluster_name" {} | ||
|
||
variable "cluster_state_bucket" {} | ||
|
||
/* | ||
* Make sure that you use the latest version of the module by changing the | ||
* `ref=` value in the `source` attribute to the latest version listed on the | ||
* releases page of this repository. | ||
* | ||
*/ | ||
module "example_team_rds" { | ||
source = "github.com/ministryofjustice/cloud-platform-terraform-rds-instance?ref=4.0" | ||
cluster_name = "${var.cluster_name}" | ||
cluster_state_bucket = "${var.cluster_state_bucket}" | ||
team_name = "example-repo" | ||
business-unit = "example-bu" | ||
application = "exampleapp" | ||
is-production = "false" | ||
environment-name = "development" | ||
infrastructure-support = "[email protected]" | ||
aws_region = "eu-west-2" | ||
provider "aws" { | ||
alias = "london" | ||
region = "eu-west-2" | ||
} | ||
|
||
resource "kubernetes_secret" "example_team_rds" { | ||
metadata { | ||
name = "example-team-rds-instance-output" | ||
namespace = "my-namespace" | ||
} | ||
|
||
data { | ||
rds_instance_endpoint = "${module.example_team_rds.rds_instance_endpoint}" | ||
database_name = "${module.example_team_rds.database_name}" | ||
database_username = "${module.example_team_rds.database_username}" | ||
database_password = "${module.example_team_rds.database_password}" | ||
rds_instance_address = "${module.example_team_rds.rds_instance_address}" | ||
|
||
/* You can replace all of the above with the following, if you prefer to | ||
* use a single database URL value in your application code: | ||
* | ||
* url = "postgres://${module.example_team_rds.database_username}:${module.example_team_rds.database_password}@${module.example_team_rds.rds_instance_endpoint}/${module.example_team_rds.database_name}" | ||
* | ||
*/ | ||
} | ||
provider "aws" { | ||
alias = "ireland" | ||
region = "eu-west-1" | ||
} |
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,57 @@ | ||
/* | ||
* When using this module through the cloud-platform-environments, the following | ||
* two variables are automatically supplied by the pipeline. | ||
* | ||
*/ | ||
|
||
variable "cluster_name" {} | ||
|
||
variable "cluster_state_bucket" {} | ||
|
||
/* | ||
* Make sure that you use the latest version of the module by changing the | ||
* `ref=` value in the `source` attribute to the latest version listed on the | ||
* releases page of this repository. | ||
* | ||
*/ | ||
module "example_team_rds" { | ||
source = "github.com/ministryofjustice/cloud-platform-terraform-rds-instance?ref=4.2" | ||
cluster_name = "${var.cluster_name}" | ||
cluster_state_bucket = "${var.cluster_state_bucket}" | ||
team_name = "example-repo" | ||
business-unit = "example-bu" | ||
application = "exampleapp" | ||
is-production = "false" | ||
environment-name = "development" | ||
infrastructure-support = "[email protected]" | ||
|
||
# Deprecated from the version 4.2 of this module | ||
#aws_region = "eu-west-2" | ||
|
||
providers = { | ||
# Can be either "aws.london" or "aws.london" | ||
aws = "aws.london" | ||
} | ||
} | ||
|
||
resource "kubernetes_secret" "example_team_rds" { | ||
metadata { | ||
name = "example-team-rds-instance-output" | ||
namespace = "my-namespace" | ||
} | ||
|
||
data { | ||
rds_instance_endpoint = "${module.example_team_rds.rds_instance_endpoint}" | ||
database_name = "${module.example_team_rds.database_name}" | ||
database_username = "${module.example_team_rds.database_username}" | ||
database_password = "${module.example_team_rds.database_password}" | ||
rds_instance_address = "${module.example_team_rds.rds_instance_address}" | ||
|
||
/* You can replace all of the above with the following, if you prefer to | ||
* use a single database URL value in your application code: | ||
* | ||
* url = "postgres://${module.example_team_rds.database_username}:${module.example_team_rds.database_password}@${module.example_team_rds.rds_instance_endpoint}/${module.example_team_rds.database_name}" | ||
* | ||
*/ | ||
} | ||
} |
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