Skip to content

Commit 5ee4a94

Browse files
authored
Fix parameter validation upon install/update (#554)
* Fix parameter validation upon install/update **Why?** When installing or updating ADF, it did not validate the input given by the user. In some situations, this implied that it would attempt to install/update failing minutes later. Or it might not work at all after the CloudFormation deployment of the SAR template reports back as if all went well. One of the parameters, the deployment region was particularly dangerous to leave blank on an update. As that would change the bucket name that would be used by ADF to share resources. **What?** Added validations to the template. The account alias regex was found here [0]. While the role name requirements were found at [1]. * [0](https://docs.aws.amazon.com/IAM/latest/APIReference/API_CreateAccountAlias.html) * [1](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html#cfn-iam-role-rolename) * Improve regex validation according to review The Account Name requirements were fount at [0]. * [0](https://docs.aws.amazon.com/organizations/latest/APIReference/API_Account.html)
1 parent a6b8d58 commit 5ee4a94

1 file changed

Lines changed: 34 additions & 9 deletions

File tree

src/template.yml

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,48 +30,73 @@ Parameters:
3030
CrossAccountAccessRoleName:
3131
Type: String
3232
Default: OrganizationAccountAccessRole
33+
AllowedPattern: "[a-zA-Z0-9_+=,.@\\-]+"
3334

3435
MainNotificationEndpoint:
3536
Type: String
3637
Default: ""
37-
Description: "Example -> jane@example.com"
38+
Description: >-
39+
Example -> jane@example.com. (Only required when installing ADF for the
40+
first time.)
3841
3942
DeploymentAccountName:
4043
Type: String
4144
Default: ""
42-
Description: "The name of the new or existing deployment account"
45+
AllowedPattern: "[\\s\\S]*"
46+
MinLength: 0
47+
MaxLength: 50
48+
Description: >-
49+
The name of the new or existing deployment account. (Only required when
50+
installing ADF for the first time.)
4351
4452
DeploymentAccountEmailAddress:
4553
Type: String
4654
Default: ""
47-
Description: "The email address for the new or existing deployment account"
55+
Description: >-
56+
The email address for the new or existing deployment account. (Only required when
57+
installing ADF for the first time.)
4858
4959
DeploymentAccountAlias:
5060
Type: String
5161
Default: ""
52-
Description: "(Optional) Example -> companyname-deployment (must be globally unique)"
62+
AllowedPattern: "([a-z0-9](([a-z0-9]|-(?!-))*[a-z0-9])?)?"
63+
MinLength: 0
64+
MaxLength: 63
65+
Description: >-
66+
Example -> companyname-deployment (Must be globally unique. Only required when
67+
installing ADF for the first time.)
5368
5469
DeploymentAccountId:
5570
Type: String
71+
AllowedPattern: "(\\d{12})?"
5672
Default: ""
5773
Description: >-
58-
Example -> 123456789012 (Only required if you have an existing AWS Account
59-
that you wish to use as the deployment account.)
74+
Example -> 123456789012 (Only supported when installing ADF for the first time
75+
and you have an existing AWS Account that you wish to use as the deployment
76+
account. Leave blank otherwise.)
6077
6178
DeploymentAccountMainRegion:
6279
Type: String
63-
Default: ""
80+
AllowedPattern: "(us(-gov)?|ap|ca|eu|sa)-(central|(north|south)?(east|west)?)-\\d"
81+
MinLength: 6
6482
Description: "Example -> us-east-1, us-gov-west-1, eu-west-1"
6583

6684
DeploymentAccountTargetRegions:
6785
Type: CommaDelimitedList
6886
Default: ""
69-
Description: "(Optional) Example -> us-east-1, us-west-1, eu-west-3"
87+
Description: >-
88+
(Optional) Example -> us-east-1, us-west-1, eu-west-3. (Only supported when
89+
installing ADF for the first time. If you would like to update this later,
90+
please look at the adfconfig.yml file in the aws-deployment-framework-bootstrap
91+
repository.)
7092
7193
ProtectedOUs:
72-
Description: "(Optional) Example -> ou-123,ou-234"
7394
Type: CommaDelimitedList
7495
Default: ""
96+
Description: >-
97+
(Optional) Example -> ou-123,ou-234 (Only supported when installing ADF for
98+
the first time. If you would like to update this later, please look at the
99+
adfconfig.yml file in the aws-deployment-framework-bootstrap repository.)
75100
76101
LogLevel:
77102
Description: >-

0 commit comments

Comments
 (0)