-
Notifications
You must be signed in to change notification settings - Fork 19
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
[Issue 1119] Deploy DMS from database module, fixup #1129
Conversation
resource "aws_iam_role" "dms_access" { | ||
name = "dms-access-role" | ||
name_prefix = "dms-access-role" |
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.
This change is to ensure the DMS can deploy to dev / staging / prod. Roles must have unique names
type = "Service" | ||
identifiers = [ | ||
"dms.amazonaws.com", | ||
"dms.${data.aws_region.current.name}.amazonaws.com", |
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.
Error message:
"dms-access-role should have the DMS Regional Service Principal 'dms.us-east-1.amazonaws.com' as trusted entity"
@@ -85,6 +89,6 @@ data "aws_iam_policy_document" "dms_access" { | |||
"logs:ilterLogEvents", | |||
"logs:GetLogEvents" | |||
] | |||
resources = ["*"] # don't have log group yet |
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.
Its just logs, we should be able to do logs:*
, its fine
@@ -24,10 +24,10 @@ resource "aws_dms_endpoint" "target_endpoint" { | |||
certificate_arn = "arn:aws:dms:us-east-1:315341936575:cert:GWOIQRTIVQVRBL5ERMCKTUPHMM33MMDGIP57J4I" | |||
database_name = "app" | |||
endpoint_id = "api-dev-primary" | |||
endpoint_type = "source" | |||
endpoint_type = "target" |
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.
Typo, this is the target endpoint
@@ -49,7 +51,7 @@ data "aws_iam_policy_document" "dms_access" { | |||
"iam:CreateRole", | |||
"iam:AttachRolePolicy" | |||
] | |||
resources = ["arn:aws:iam:*:${data.aws_caller_identity.current.account_id}:*"] |
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.
Error message:
creating IAM Policy (dms-access): MalformedPolicyDocument: IAM resource arn:aws:iam::315341936575: cannot contain region information.
@@ -1,24 +0,0 @@ | |||
# This file is maintained automatically by "terraform init". |
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.
superfluous lockfiles
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.
Approving to unblock, but this isn't my area of expertise.
@@ -35,7 +36,8 @@ data "aws_iam_policy_document" "dms_access" { | |||
sid = "AllowDMSAccess" | |||
effect = "Allow" | |||
actions = ["dms:*"] | |||
resources = [""] # arn for the actual dms service goes here | |||
resources = ["arn:aws:dms:*:${data.aws_caller_identity.current.account_id}:*"] | |||
# TODO! arn for the actual dms service goes here |
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.
Do we still need the TODO comment?
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.
Yep! The DMS isn't up yet, and I do want to fill it in.
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.
Looks good, thank you.
engine_name = "aurora-postgresql" | ||
kms_key_arn = aws_kms_key.dms_endpoints.arn | ||
secrets_manager_access_role_arn = data.aws_iam_role.dms_access.arn | ||
secrets_manager_access_role_arn = aws_iam_role.dms_access.arn |
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.
Since this was changed to refer directly to the role, can we remove lines 59-61 in this file? data "aws_iam_role" "dms_access" { ... }
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.
Oh! Yep
engine_name = "aurora-postgresql" | ||
kms_key_arn = aws_kms_key.dms_endpoints.arn | ||
secrets_manager_access_role_arn = data.aws_iam_role.dms_access.arn | ||
secrets_manager_access_role_arn = aws_iam_role.dms_access.arn | ||
ssl_mode = "verify-ca" | ||
secrets_manager_arn = data.aws_secretsmanager_secret.target_db.arn |
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.
I think this is the same secret as the one defined in role-manager.tf
as data "aws_secretsmanager_secret" "db_password" { ... }
. Should we re-use that one, then remove lines 52-55 below with the hard-coded name?
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.
Mhmm! I'm planning on doing that next o7
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.
Summary
Rolls up to #1119
Time to review: 2 mins
Context for reviewers
I tried to deploy the DMS, and noticed 2 things:
terraform init -backend-config=SOMETHING
on. So I was unable to pull the existing state. This is why I moved the IAM role to the database module, which is deployed frominfra/api/database
I then proceeded to deploy to
dev
and fix everything I could findDeployment
I've already deployed this to dev to test. It still doesn't fully deploy - for reasons I will solve in a different PR tomorrow.