Skip to content

Commit

Permalink
Fix: [AEA-4386] - add permissions to delete cnames to dev (#434)
Browse files Browse the repository at this point in the history
## Summary

- Routine Change

### Details

- add permissions to delete CNAMES in dev
  • Loading branch information
anthony-nhs authored Aug 28, 2024
1 parent b125d09 commit c49a617
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 5 deletions.
24 changes: 24 additions & 0 deletions cloudformation/ci_resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ Parameters:
Description: >
Subject claim filter for valid tokens for the proxygen prod role.
Default: ""
EnableDeleteCNAME:
Type: String
Description: Whether to allow delete CNAME permissions
Default: false
AllowedValues: [true, false]

Conditions:
ShouldCreateDeleteCNAMEpermissions: !Equals [true, !Ref EnableDeleteCNAME]

Resources:
##################################################
Expand Down Expand Up @@ -171,6 +179,22 @@ Resources:
- ecr:GetAuthorizationToken
Resource: "*"

RemoveOldCNAMERecordsPolicy:
Condition: ShouldCreateDeleteCNAMEpermissions
Type: AWS::IAM::ManagedPolicy
Properties:
Roles:
- Ref: CloudFormationDeployRole
PolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Action:
- route53:ChangeResourceRecordSets
- route53:ListHostedZonesByName
- route53:ListResourceRecordSets
Resource: !Sub "arn:aws::${AWS::Region}:${AWS::AccountId}:*"

##################################################
# Cloudformation Execution Role
##################################################
Expand Down
3 changes: 2 additions & 1 deletion cloudformation/env/dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
],
"ProxygenProdClaimFilters": [
"NONE"
]
],
"EnableDeleteCNAME": "true"
},
"account-resources": {},
"lambda-resources": {
Expand Down
3 changes: 2 additions & 1 deletion cloudformation/env/int.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
],
"ProxygenProdClaimFilters": [
"NONE"
]
],
"EnableDeleteCNAME": "false"
},
"account-resources": {},
"lambda-resources": {
Expand Down
3 changes: 2 additions & 1 deletion cloudformation/env/prod.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"ProxygenProdClaimFilters": [
"repo:NHSDigital/eps-prescription-status-update-api:environment:int",
"repo:NHSDigital/eps-prescription-status-update-api:environment:prod"
]
],
"EnableDeleteCNAME": "false"
},
"account-resources": {},
"lambda-resources": {
Expand Down
3 changes: 2 additions & 1 deletion cloudformation/env/qa.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
],
"ProxygenProdClaimFilters": [
"NONE"
]
],
"EnableDeleteCNAME": "false"
},
"account-resources": {},
"lambda-resources": {
Expand Down
3 changes: 2 additions & 1 deletion cloudformation/env/ref.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
],
"ProxygenProdClaimFilters": [
"NONE"
]
],
"EnableDeleteCNAME": "false"
},
"account-resources": {},
"lambda-resources": {
Expand Down

0 comments on commit c49a617

Please sign in to comment.