Skip to content

Commit

Permalink
fixed some more
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Tuszynski committed Mar 26, 2021
1 parent 710827b commit cb7f16b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 58 deletions.
24 changes: 0 additions & 24 deletions copilot/todo-app/addons/db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -248,27 +248,3 @@ Outputs:
PostgresData: # injected as POSTGRES_DATA environment variable by Copilot.
Description: "The JSON secret that holds the database username and password. Fields are 'host', 'dbname', 'username', 'password'"
Value: !Ref AuroraSecret

AuroraDBCluster:
Description: "Cluster Reference for Credential Rotation"
Value: !Ref AuroraDBCluster
Export:
Name: AuroraDBCluster

RotationSecurityGroup:
Description: "The Credential Rotation Security Group"
Value: !Ref RotationSecurityGroup
Export:
Name: RotationSecurityGroup

SecretAuroraClusterAttachment:
Description: "The Credential Attachment to the Cluster"
Value: !Ref SecretAuroraClusterAttachment
Export:
Name: SecretAuroraClusterAttachment

AuroraSecret:
Description: "The secret credential to pass to rotation stack"
Value: !Ref AuroraSecret
Export:
Name: AuroraSecret
68 changes: 34 additions & 34 deletions rotation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
AWSTemplateFormatVersion: 2010-09-09
Transform:
- "AWS::Serverless-2016-10-31"

Parameters:
App:
Type: String
Expand All @@ -16,37 +16,37 @@ Parameters:

Resources:
SecretRotationTemplate:
Type: AWS::Serverless::Application
Properties:
Location:
ApplicationId: arn:aws:serverlessrepo:us-east-1:297356227824:applications/SecretsManagerRDSPostgreSQLRotationSingleUser
SemanticVersion: 1.1.60
Parameters:
endpoint: !Sub https://secretsmanager.${AWS::Region}.amazonaws.com
functionName: !Sub ${AWS::StackName}-func
vpcSecurityGroupIds: !ImportValue RotationSecurityGroup
vpcSubnetIds:
Fn::Join:
- ","
- - !Select [
0,
!Split [
",",
{ "Fn::ImportValue": !Sub "${App}-${Env}-PrivateSubnets" },
],
]
- !Select [
1,
!Split [
",",
{ "Fn::ImportValue": !Sub "${App}-${Env}-PrivateSubnets" },
],
]
Type: AWS::Serverless::Application
Properties:
Location:
ApplicationId: arn:aws:serverlessrepo:us-east-1:297356227824:applications/SecretsManagerRDSPostgreSQLRotationSingleUser
SemanticVersion: 1.1.60
Parameters:
endpoint: !Sub https://secretsmanager.${AWS::Region}.amazonaws.com
functionName: !Sub ${AWS::StackName}-func
vpcSecurityGroupIds: !Ref RotationSecurityGroup
vpcSubnetIds:
Fn::Join:
- ","
- - !Select [
0,
!Split [
",",
{ "Fn::ImportValue": !Sub "${App}-${Env}-PrivateSubnets" },
],
]
- !Select [
1,
!Split [
",",
{ "Fn::ImportValue": !Sub "${App}-${Env}-PrivateSubnets" },
],
]

SecretRotationSchedule:
Type: AWS::SecretsManager::RotationSchedule
Properties:
SecretId: !ImportValue AuroraSecret
RotationLambdaARN: !GetAtt SecretRotationTemplate.Outputs.RotationLambdaARN
RotationRules:
AutomaticallyAfterDays: 30
Type: AWS::SecretsManager::RotationSchedule
Properties:
SecretId: !Ref AuroraSecret
RotationLambdaARN: !GetAtt SecretRotationTemplate.Outputs.RotationLambdaARN
RotationRules:
AutomaticallyAfterDays: 30

0 comments on commit cb7f16b

Please sign in to comment.