Fix CloudFormation stack's Outputs #320
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #237
Description of Issue Fixed:
After the refactor from v2.x to v3.x, the CloudFormation stack's Outputs stopped showing
DistributionDomainName
,DomainName
, andHostedZoneId
. This PR fixes the problem, and results in those values being added to the CF stack's Outputs again.Root Cause:
In v2.x, when the base path mapping was still being created/managed through CloudFormation (the point at which the CF stack's Outputs were updated), this process was taking place before the deployment, as shown in the v2.x lifecycle hook:
However, after moving to v3.x and creating/managing the base path mapping through the API, the process was updated to take place after the deployment, as shown in the v3.x lifecycle hook:
This change broke the process of adding anything to the CF stack's Outputs, since
addOutputs(domainInfo)
(which is called bysetupBasePathMapping()
) is modifyingservice.provider.compiledCloudFormationTemplate.Outputs
locally with the additional CF stack Outputs entries after the deployment, but can only actually have an effect on the live CF stack if the local modification happens before the deployment.Changes proposed in this pull request:
Move the
addOutputs(domainInfo)
call to its own new lifecycle function (separate fromsetupBasePathMapping()
), which gets triggered before the deployment, allowing the locally modifiedservice.provider.compiledCloudFormationTemplate.Outputs
object to actually be processed and therefore update the CF stack's Outputs during the deployment.Update the CloudFormation stack's 'Outputs' naming to align with the README and the Serverless Domain Manager Summary console output.
Currently, only
DomainName
andHostedZoneId
are included in the code that is supposed to generate the CF stack's Outputs (which currently isn't actually working, but is fixed by this PR). Furthermore, the value ofDomainName
is actually being populated with the distribution domain name, which is incorrect.The README states that
DistributionDomainName
andDomainName
are both added to the CF stack's Outputs, but the current code would only addHostedZoneId
andDomainName
(populated with distribution domain name). This PR populatesDomainName
with the actual domain name, and adds the missingDistributionDomainName
entry, along with the correct value.Interestingly, the current Serverless Domain Manager Summary output in the console log shows the expected values correctly, so this PR aligns the CF stack's 'Outputs' naming and values with the Serverless Domain Manager Summary console output.
Added a newline to improve the appearance of the console log output for the Serverless Domain Manager Summary.
Minor fix to unit tests, to add
Distribution Domain Name
to the unit test description.Impact:
Before (notice only 4 Stack Outputs):
After (notice all 7 Stack Outputs, and newline after
Serverless
):