Skip to content

Commit

Permalink
feat: ability to import using option
Browse files Browse the repository at this point in the history
  • Loading branch information
the-avid-engineer committed Jun 13, 2024
1 parent 6e7537a commit 8e47a5b
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/InfrastructureCli/Services/AwsCloudFormationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -494,10 +494,25 @@ private async Task<bool> CreateStackWithChangeSet(DeployOptions deployOptions)
_console.Out.WriteLine("ChangeSet already exists.");
return false;
}

ChangeSetType changeSetType;
List<ResourceToImport>? resourcesToImport;

if (deployOptions.Options.TryGetValue("ResourcesToImport", out var resourcesToImportJson))
{
changeSetType = ChangeSetType.IMPORT;
resourcesToImport = JsonSerializer.Deserialize<List<ResourceToImport>>(resourcesToImportJson);
}
else
{
changeSetType = ChangeSetType.CREATE;
resourcesToImport = null;
}

var request = new CreateChangeSetRequest
{
ChangeSetType = ChangeSetType.CREATE,
ChangeSetType = changeSetType,
ResourcesToImport = resourcesToImport,
ChangeSetName = changeSetName,
StackName = GetStackName(),
Capabilities = GetCapabilities(),
Expand Down

0 comments on commit 8e47a5b

Please sign in to comment.