One of our newly built Confluence stacks failed to start, and the error message is as below:
BootstrapException: Unable to bootstrap application: Failed to parse config file: Error on line 19 of document : The reference to entity “k” must end with the ‘;’ delimiter. Nested exception: The reference to entity “k” must end with the ‘;’ delimiter.
As written in my previous post Use AWS Secret Manager to handle credentials, we use AWS secret manager to generate random password for the Confluence database. The reason is that the randomly generated database password has a special character > that caused the syntax error in the confluence.cfg.xml file.
The fix is simply to exclude those special characters in the CloudFormation via ExcludeCharacters property. For example:
DbUserPassword:
Type: 'AWS::SecretsManager::Secret'
Properties:
Name: /confluence/database/
Description: confluence DB password
GenerateSecretString:
SecretStringTemplate: '{"username": "confluence"}'
GenerateStringKey: "password"
PasswordLength: 16
ExcludeCharacters: '"@/\<>'
KmsKeyId: !ImportValue EnvKmsKeyId
Tags:
- Key: Name
Value: confluence-db
- Key: Environment
Value: !Ref Env