Skip to content

Commit 8e4922a

Browse files
committed
test(terraform): add Terratest setup using Go
1 parent 48027d6 commit 8e4922a

File tree

4 files changed

+22
-9
lines changed

4 files changed

+22
-9
lines changed

examples/data.tf

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,20 @@ data "aws_vpc" "vpc" {
66
}
77
}
88

9-
## Network
9+
## Network - Public Subnets
1010
data "aws_subnets" "this" {
1111
filter {
1212
name = "tag:Name"
1313
values = [
14-
"${var.project_name}-${var.environment}-subnet-${var.region}a",
15-
"${var.project_name}-${var.environment}-subnet-${var.region}b"
14+
"${var.project_name}-${var.environment}-public-subnet-public-${var.region}a",
15+
"${var.project_name}-${var.environment}-public-subnet-public-${var.region}b"
1616
]
1717
}
18+
19+
filter {
20+
name = "vpc-id"
21+
values = [data.aws_vpc.vpc.id]
22+
}
1823
}
1924

2025
## Security
@@ -32,9 +37,9 @@ data "aws_security_groups" "this" {
3237

3338
## Secrets Manager
3439
data "aws_secretsmanager_secret" "source-secret" {
35-
name = "source-secret"
40+
name = "arc-poc-rds-connection-details"
3641
}
3742

3843
data "aws_secretsmanager_secret" "target-secret" {
39-
name = "target-secret"
44+
name = "arc-dev-target-database-connection"
4045
}

examples/main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ module "aws_dms" {
4343
instance_allocated_storage = 5
4444
instance_apply_immediately = true
4545
instance_network_type = "IPV4"
46-
instance_class = "dms.t2.micro"
47-
instance_id = "DMS-POC"
46+
instance_class = "dms.t3.micro"
47+
instance_id = "dms-poc"
4848
instance_subnet_group_id = "dms-poc-public-subnet-group"
4949
instance_publicly_accessible = true
5050
instance_vpc_security_group_ids = data.aws_security_groups.this.ids #Security Group ID
@@ -54,7 +54,7 @@ module "aws_dms" {
5454
endpoint_id = "dms-poc-endpoint-1"
5555
endpoint_type = "source"
5656
engine_name = "postgres"
57-
database_name = "poc"
57+
database_name = "poc_source"
5858
secrets_manager_arn = data.aws_secretsmanager_secret.source-secret.arn #Source endpoint secret arn
5959
ssl_mode = "require"
6060

examples/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ variable "environment" {
2424
variable "project_name" {
2525
description = "Name of the project the vpn resource belongs to."
2626
type = string
27-
default = "arc-example"
27+
default = "arc"
2828
}

modules/dms/main.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ resource "aws_iam_role_policy" "dms_secrets_manager_access_policy" {
4040
Effect = "Allow",
4141
Action = "iam:PassRole",
4242
Resource = aws_iam_role.dms_secrets_manager_access_role.arn
43+
},
44+
{
45+
Effect = "Allow",
46+
Action = [
47+
"kms:Decrypt",
48+
"kms:DescribeKey"
49+
],
50+
Resource = "*"
4351
}
4452
]
4553
})

0 commit comments

Comments
 (0)