Skip to content

Commit 658fb7b

Browse files
authored
Merge pull request #33 from byu-oit/db_subnet_group
export db_subnet_group object
2 parents b64ce57 + 147cacb commit 658fb7b

File tree

6 files changed

+47
-29
lines changed

6 files changed

+47
-29
lines changed

README.md

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,47 +10,50 @@ This module retrieves some basic [ACS](https://github.com/byu-oit/aws-acs) infor
1010

1111
```hcl
1212
module "acs" {
13-
source = "github.com/byu-oit/terraform-aws-acs-info.git?ref=v3.1.0"
13+
source = "github.com/byu-oit/terraform-aws-acs-info.git?ref=v3.2.0"
1414
}
1515
```
16+
1617
After defining the module you can then retrieve the information you need (see available [outputs](#output) below) using the interpolation syntax:
18+
1719
```hcl
1820
...
1921
vpc_id = module.acs.vpc.id
2022
2123
```
2224

2325
## Requirements
26+
2427
* Terraform version 0.12.17 or greater
2528

2629
## Input
2730

28-
| Name | Type | Description | Default Value |
29-
| --- | --- | --- | --- |
30-
| vpc_vpn_to_campus | bool | Retrieve VPC info for the VPC that has VPN access to campus | false |
31+
| Name | Type | Description | Default Value |
32+
| ----------------- | ---- | ----------------------------------------------------------- | ------------- |
33+
| vpc_vpn_to_campus | bool | Retrieve VPC info for the VPC that has VPN access to campus | false |
3134

3235
## Output
3336

34-
| Name | Type |Description |
35-
| --- | --- | --- |
36-
| power_user_role | [object](https://www.terraform.io/docs/providers/aws/d/iam_role.html#attributes-reference) | The IAM PowerUser Role object |
37-
| power_builder_role | [object](https://www.terraform.io/docs/providers/aws/d/iam_role.html#attributes-reference) | The IAM PowerBuilder Role object |
38-
| role_permissions_boundary | [object](https://www.terraform.io/docs/providers/aws/d/iam_policy.html#attributes-reference) | The IAM role permissions boundary policy object |
39-
| user_permissions_boundary | [object](https://www.terraform.io/docs/providers/aws/d/iam_policy.html#attributes-reference) | The IAM user permissions boundary policy object |
40-
| vpc | [object](https://www.terraform.io/docs/providers/aws/d/vpc.html#attributes-reference) | The VPC object |
41-
| private_subnet_ids | list(string) | List of subnet_ids for the private subnets in the specified VPC |
42-
| public_subnet_ids | list(string) | List of subnet_ids for the public subnets in the specified VPC |
43-
| data_subnet_ids | list(string) | List of subnet_ids for the data subnets in the specified VPC |
44-
| private_subnets | list([object](https://www.terraform.io/docs/providers/aws/r/subnet.html#attributes-reference)) | List of private subnet objects in the specified VPC |
45-
| public_subnets | list([object](https://www.terraform.io/docs/providers/aws/r/subnet.html#attributes-reference)) | List of public subnet object in the specified VPC |
46-
| data_subnets | list([object](https://www.terraform.io/docs/providers/aws/r/subnet.html#attributes-reference)) | List of data subnet objects in the specified VPC |
47-
| route53_zone | [object](https://www.terraform.io/docs/providers/aws/r/route53_zone.html#attributes-reference) | The Route53 zone object |
48-
| certificate | [object](https://www.terraform.io/docs/providers/aws/d/acm_certificate.html#attributes-reference) | The default zone's ACM certificate object) |
49-
| certificate_virginia | [object](https://www.terraform.io/docs/providers/aws/d/acm_certificate.html#attributes-reference) | The default zone's ACM certificate for us-east-1 (needed by CloudFront, API Gateway, etc.) object |
50-
| db_subnet_group_name | [object](https://www.terraform.io/docs/providers/aws/d/security_group.html) | The database subnet group name for RDS in the specified VPC object |
51-
| ssh_rdp_security_group | [object](https://www.terraform.io/docs/providers/aws/d/security_group.html) | The security group to enable SSH/RDP access to resources in the specified VPC object |
52-
| oracle_security_group | [object](https://www.terraform.io/docs/providers/aws/d/security_group.html) | The security group to enable Oracle access to resources in the specified VPC object |
53-
| github_token | string | The token to use in CI/CD pipelines to fetch source code from GitHub (this if only available in certain AWS accounts) |
37+
| Name | Type | Description |
38+
| ------------------------- | -------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
39+
| power_user_role | [object](https://www.terraform.io/docs/providers/aws/d/iam_role.html#attributes-reference) | The IAM PowerUser Role object |
40+
| power_builder_role | [object](https://www.terraform.io/docs/providers/aws/d/iam_role.html#attributes-reference) | The IAM PowerBuilder Role object |
41+
| role_permissions_boundary | [object](https://www.terraform.io/docs/providers/aws/d/iam_policy.html#attributes-reference) | The IAM role permissions boundary policy object |
42+
| user_permissions_boundary | [object](https://www.terraform.io/docs/providers/aws/d/iam_policy.html#attributes-reference) | The IAM user permissions boundary policy object |
43+
| vpc | [object](https://www.terraform.io/docs/providers/aws/d/vpc.html#attributes-reference) | The VPC object |
44+
| private_subnet_ids | list(string) | List of subnet_ids for the private subnets in the specified VPC |
45+
| public_subnet_ids | list(string) | List of subnet_ids for the public subnets in the specified VPC |
46+
| data_subnet_ids | list(string) | List of subnet_ids for the data subnets in the specified VPC |
47+
| private_subnets | list([object](https://www.terraform.io/docs/providers/aws/r/subnet.html#attributes-reference)) | List of private subnet objects in the specified VPC |
48+
| public_subnets | list([object](https://www.terraform.io/docs/providers/aws/r/subnet.html#attributes-reference)) | List of public subnet object in the specified VPC |
49+
| data_subnets | list([object](https://www.terraform.io/docs/providers/aws/r/subnet.html#attributes-reference)) | List of data subnet objects in the specified VPC |
50+
| route53_zone | [object](https://www.terraform.io/docs/providers/aws/r/route53_zone.html#attributes-reference) | The Route53 zone object |
51+
| certificate | [object](https://www.terraform.io/docs/providers/aws/d/acm_certificate.html#attributes-reference) | The default zone's ACM certificate object) |
52+
| certificate_virginia | [object](https://www.terraform.io/docs/providers/aws/d/acm_certificate.html#attributes-reference) | The default zone's ACM certificate for us-east-1 (needed by CloudFront, API Gateway, etc.) object |
53+
| db_subnet_group_name | string | **Deprecated** Use `db_subnet_group.name` |
54+
| db_subnet_group | [object](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/db_subnet_group) | The database subnet group for RDS in the specified VPC object |
55+
| ssh_rdp_security_group | [object](https://www.terraform.io/docs/providers/aws/d/security_group.html) | The security group to enable SSH/RDP access to resources in the specified VPC object |
56+
| oracle_security_group | [object](https://www.terraform.io/docs/providers/aws/d/security_group.html) | The security group to enable Oracle access to resources in the specified VPC object |
57+
| github_token | string | The token to use in CI/CD pipelines to fetch source code from GitHub (this if only available in certain AWS accounts) |
5458

5559
**Note about returning objects**: Because objects are returned (as opposed to just values), autocomplete may not work. Just add on the key to the end out the output accessor. Even though autocomplete won't work, those values will still be correctly returned.
56-

examples/ci-12/ci.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ output "certificate_virginia" {
5656
output "db_subnet_group_name" {
5757
value = module.acs.db_subnet_group_name
5858
}
59+
output "db_subnet_group" {
60+
value = module.acs.db_subnet_group
61+
}
5962
output "ssh_rdp_security_group" {
6063
value = module.acs.ssh_rdp_security_group
6164
}

examples/ci-13/ci.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ output "certificate_virginia" {
5656
output "db_subnet_group_name" {
5757
value = module.acs.db_subnet_group_name
5858
}
59+
output "db_subnet_group" {
60+
value = module.acs.db_subnet_group
61+
}
5962
output "ssh_rdp_security_group" {
6063
value = module.acs.ssh_rdp_security_group
6164
}

examples/simple/simple.tf

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ provider "aws" {
33
}
44

55
module "acs" {
6-
// source = "../../"
7-
source = "github.com/byu-oit/terraform-aws-acs-info?ref=v3.1.0"
6+
source = "github.com/byu-oit/terraform-aws-acs-info?ref=v3.2.0"
87
}
98

109
output "vpc_id" {

main.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ data "aws_acm_certificate" "virginia" {
102102
domain = trim(data.aws_route53_zone.zone[0].name, ".")
103103
}
104104

105+
// RDS info
106+
data "aws_db_subnet_group" "db_subnet_group" {
107+
name = "${local.vpc_name}-db-subnet-group"
108+
}
109+
105110
// Security Group info
106111
data "aws_security_group" "ssh_rdp" {
107112
filter {

output.tf

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,13 @@ output "certificate_virginia" {
4848

4949
// RDS Outputs
5050
output "db_subnet_group_name" {
51-
// Terraform doens't have a data accessor for this, so we have to concatenate these strings
52-
value = "${local.vpc_name}-db-subnet-group"
51+
// Terraform didn't used to have a data accessor for this, so the best we could do was return the name
52+
// Keeping for backwards compatibility
53+
value = data.aws_db_subnet_group.db_subnet_group.name
54+
}
55+
56+
output "db_subnet_group" {
57+
value = data.aws_db_subnet_group.db_subnet_group
5358
}
5459

5560
// Security Group Outputs

0 commit comments

Comments
 (0)