Commit 0f3d57ff authored by Christian Kemper's avatar Christian Kemper

adding secrets manager vpc end point support

parent 1d5f04ca
<a name="unreleased"></a> <a name="unreleased"></a>
## [Unreleased] ## [Unreleased]
- Updated CHANGELOG
- Added VPC endpoint for Secrets Manager,
<a name="v2.7.0"></a> <a name="v2.7.0"></a>
## [v2.7.0] - 2019-06-17 ## [v2.7.0] - 2019-06-17
......
...@@ -18,7 +18,7 @@ These types of resources are supported: ...@@ -18,7 +18,7 @@ These types of resources are supported:
* Gateway: S3, DynamoDB * Gateway: S3, DynamoDB
* Interface: EC2, SSM, EC2 Messages, SSM Messages, SQS, ECR API, ECR DKR, API Gateway, KMS, * Interface: EC2, SSM, EC2 Messages, SSM Messages, SQS, ECR API, ECR DKR, API Gateway, KMS,
ECS, ECS Agent, ECS Telemetry, SNS, CloudWatch(Monitoring, Logs, Events), Elastic Load Balancing, ECS, ECS Agent, ECS Telemetry, SNS, CloudWatch(Monitoring, Logs, Events), Elastic Load Balancing,
CloudTrail CloudTrail, Secrets Manager
* [RDS DB Subnet Group](https://www.terraform.io/docs/providers/aws/r/db_subnet_group.html) * [RDS DB Subnet Group](https://www.terraform.io/docs/providers/aws/r/db_subnet_group.html)
* [ElastiCache Subnet Group](https://www.terraform.io/docs/providers/aws/r/elasticache_subnet_group.html) * [ElastiCache Subnet Group](https://www.terraform.io/docs/providers/aws/r/elasticache_subnet_group.html)
* [Redshift Subnet Group](https://www.terraform.io/docs/providers/aws/r/redshift_subnet_group.html) * [Redshift Subnet Group](https://www.terraform.io/docs/providers/aws/r/redshift_subnet_group.html)
...@@ -374,6 +374,9 @@ Sometimes it is handy to have public access to Redshift clusters (for example if ...@@ -374,6 +374,9 @@ Sometimes it is handy to have public access to Redshift clusters (for example if
| ssm\_endpoint\_private\_dns\_enabled | Whether or not to associate a private hosted zone with the specified VPC for SSM endpoint | bool | `"false"` | no | | ssm\_endpoint\_private\_dns\_enabled | Whether or not to associate a private hosted zone with the specified VPC for SSM endpoint | bool | `"false"` | no |
| ssm\_endpoint\_security\_group\_ids | The ID of one or more security groups to associate with the network interface for SSM endpoint | list(string) | `[]` | no | | ssm\_endpoint\_security\_group\_ids | The ID of one or more security groups to associate with the network interface for SSM endpoint | list(string) | `[]` | no |
| ssm\_endpoint\_subnet\_ids | The ID of one or more subnets in which to create a network interface for SSM endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | list(string) | `[]` | no | | ssm\_endpoint\_subnet\_ids | The ID of one or more subnets in which to create a network interface for SSM endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | list(string) | `[]` | no |
| secretsmanager\_endpoint\_private\_dns\_enabled | Whether or not to associate a private hosted zone with the specified VPC for Secrets Manager endpoint | bool | `"false"` | no |
| secretsmanager\_endpoint\_security\_group\_ids | The ID of one or more security groups to associate with the network interface for Secrets Manager endpoint | list(string) | `[]` | no |
| secretsmanager\_endpoint\_subnet\_ids | The ID of one or more subnets in which to create a network interface for Secrets Manager endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | list(string) | `[]` | no |
| ssmmessages\_endpoint\_private\_dns\_enabled | Whether or not to associate a private hosted zone with the specified VPC for SSMMESSAGES endpoint | bool | `"false"` | no | | ssmmessages\_endpoint\_private\_dns\_enabled | Whether or not to associate a private hosted zone with the specified VPC for SSMMESSAGES endpoint | bool | `"false"` | no |
| ssmmessages\_endpoint\_security\_group\_ids | The ID of one or more security groups to associate with the network interface for SSMMESSAGES endpoint | list(string) | `[]` | no | | ssmmessages\_endpoint\_security\_group\_ids | The ID of one or more security groups to associate with the network interface for SSMMESSAGES endpoint | list(string) | `[]` | no |
| ssmmessages\_endpoint\_subnet\_ids | The ID of one or more subnets in which to create a network interface for SSMMESSAGES endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | list(string) | `[]` | no | | ssmmessages\_endpoint\_subnet\_ids | The ID of one or more subnets in which to create a network interface for SSMMESSAGES endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | list(string) | `[]` | no |
......
...@@ -920,6 +920,27 @@ resource "aws_vpc_endpoint" "sqs" { ...@@ -920,6 +920,27 @@ resource "aws_vpc_endpoint" "sqs" {
private_dns_enabled = var.sqs_endpoint_private_dns_enabled private_dns_enabled = var.sqs_endpoint_private_dns_enabled
} }
###################################
# VPC Endpoint for Secrets Manager
###################################
data "aws_vpc_endpoint_service" "secretsmanager" {
count = var.create_vpc && var.enable_secretsmanager_endpoint ? 1 : 0
service = "secretsmanager"
}
resource "aws_vpc_endpoint" "secretsmanager" {
count = var.create_vpc && var.enable_secretsmanager_endpoint ? 1 : 0
vpc_id = local.vpc_id
service_name = data.aws_vpc_endpoint_service.secretsmanager[0].service_name
vpc_endpoint_type = "Interface"
security_group_ids = var.secretsmanager_endpoint_security_group_ids
subnet_ids = coalescelist(var.secretsmanager_endpoint_subnet_ids, aws_subnet.private.*.id)
private_dns_enabled = var.secretsmanager_endpoint_private_dns_enabled
}
####################### #######################
# VPC Endpoint for SSM # VPC Endpoint for SSM
####################### #######################
......
...@@ -262,6 +262,30 @@ variable "ssm_endpoint_private_dns_enabled" { ...@@ -262,6 +262,30 @@ variable "ssm_endpoint_private_dns_enabled" {
default = false default = false
} }
variable "enable_secretsmanager_endpoint" {
description = "Should be true if you want to provision an Secrets Manager endpoint to the VPC"
type = bool
default = false
}
variable "secretsmanager_endpoint_security_group_ids" {
description = "The ID of one or more security groups to associate with the network interface for Secrets Manager endpoint"
type = list(string)
default = []
}
variable "secretsmanager_endpoint_subnet_ids" {
description = "The ID of one or more subnets in which to create a network interface for Secrets Manager endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used."
type = list(string)
default = []
}
variable "secretsmanager_endpoint_private_dns_enabled" {
description = "Whether or not to associate a private hosted zone with the specified VPC for Secrets Manager endpoint"
type = bool
default = false
}
variable "enable_ssmmessages_endpoint" { variable "enable_ssmmessages_endpoint" {
description = "Should be true if you want to provision a SSMMESSAGES endpoint to the VPC" description = "Should be true if you want to provision a SSMMESSAGES endpoint to the VPC"
type = bool type = bool
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment