diff --git a/src/AWS.Deploy.Recipes.CDK.Common/CDKRecipeSetup.cs b/src/AWS.Deploy.Recipes.CDK.Common/CDKRecipeSetup.cs index 06c5e2d3d..6d85bffb4 100644 --- a/src/AWS.Deploy.Recipes.CDK.Common/CDKRecipeSetup.cs +++ b/src/AWS.Deploy.Recipes.CDK.Common/CDKRecipeSetup.cs @@ -5,6 +5,7 @@ using Microsoft.Extensions.Configuration; using Amazon.CDK; +using System.Text.Json.Serialization; namespace AWS.Deploy.Recipes.CDK.Common { @@ -27,7 +28,13 @@ public static void RegisterStack(Stack stack, IRecipeProps recipeConfigura stack.Tags.SetTag(Constants.CloudFormationIdentifier.STACK_TAG, $"{recipeConfiguration.RecipeId}"); // Serializes all AWS .NET deployment tool settings. - var json = JsonSerializer.Serialize(recipeConfiguration.Settings, new JsonSerializerOptions { WriteIndented = false }); + var json = JsonSerializer.Serialize( + recipeConfiguration.Settings, + new JsonSerializerOptions + { + WriteIndented = false, + Converters = { new JsonStringEnumConverter() } + }); Dictionary metadata; if(stack.TemplateOptions.Metadata?.Count > 0) diff --git a/src/AWS.Deploy.Recipes/CdkTemplates/AspNetAppEcsFargate/Generated/Configurations/AutoScalingConfiguration.cs b/src/AWS.Deploy.Recipes/CdkTemplates/AspNetAppEcsFargate/Generated/Configurations/AutoScalingConfiguration.cs index fef28be43..d1b887216 100644 --- a/src/AWS.Deploy.Recipes/CdkTemplates/AspNetAppEcsFargate/Generated/Configurations/AutoScalingConfiguration.cs +++ b/src/AWS.Deploy.Recipes/CdkTemplates/AspNetAppEcsFargate/Generated/Configurations/AutoScalingConfiguration.cs @@ -19,7 +19,7 @@ public class AutoScalingConfiguration public enum ScalingTypeEnum { Cpu, Memory, Request } - public ScalingTypeEnum ScalingType { get; set; } = ScalingTypeEnum.Cpu; + public ScalingTypeEnum? ScalingType { get; set; } diff --git a/test/AWS.Deploy.CLI.IntegrationTests/WebAppWithDockerFileTests.cs b/test/AWS.Deploy.CLI.IntegrationTests/WebAppWithDockerFileTests.cs index cf98e46c6..016ff9de1 100644 --- a/test/AWS.Deploy.CLI.IntegrationTests/WebAppWithDockerFileTests.cs +++ b/test/AWS.Deploy.CLI.IntegrationTests/WebAppWithDockerFileTests.cs @@ -102,6 +102,17 @@ public async Task DefaultConfigurations() var listDeployStdOut = _interactiveService.StdOutReader.ReadAllLines(); Assert.Contains(listDeployStdOut, (deployment) => _stackName.Equals(deployment)); + // Arrange input for re-deployment + await _interactiveService.StdInWriter.WriteAsync(Environment.NewLine); // Select default option settings + await _interactiveService.StdInWriter.FlushAsync(); + + // Perform re-deployment + deployArgs = new[] { "deploy", "--project-path", projectPath, "--stack-name", _stackName, "--diagnostics" }; + var returnCode = await _app.Run(deployArgs); + Assert.Equal(CommandReturnCodes.SUCCESS, returnCode); + Assert.Equal(StackStatus.UPDATE_COMPLETE, await _cloudFormationHelper.GetStackStatus(_stackName)); + Assert.Equal("ACTIVE", cluster.Status); + // Arrange input for delete await _interactiveService.StdInWriter.WriteAsync("y"); // Confirm delete await _interactiveService.StdInWriter.FlushAsync();