Skip to content

Commit

Permalink
feat(cli/cmd): CLI survey code for azure - ALLY-394 (#720)
Browse files Browse the repository at this point in the history
* feat(cli/cmd): Initial CLI survey code for azure - ALLY-394

* feat(lwgenerate): Updates to remove string literals from module elements  - ALLY-394

* feat(cli/cmd): Addition of integration tests - ALLY-394

* feat(cli/cmd): Updated integration tests for Azure terraform generation - ALLY-394

* feat(cli/cmd): fixed assert failure on integration test - ALLY-394

* feat(cli/cmd): Updated from review comments, updated integration tests - ALLY-394

* feat(cli/cmd): fix rebase issues,updated integration tests - ALLY-394

* feat(cli/cmd): Add azure help tests - ALLY-394

* feat(cli/cmd): Review comment updates, update of tests  - ALLY-394

* feat(cli/cmd): Remove env setting for testing - ALLY-394

* feat(cli/cmd): Update to storage account name setting - ALLY-394

* feat(cli/cmd): Update cli flags to match format we have in GCP and AWS - ALLY-394
  • Loading branch information
djmctavish authored Mar 24, 2022
1 parent fc74684 commit 73f8b0c
Show file tree
Hide file tree
Showing 22 changed files with 1,830 additions and 68 deletions.
18 changes: 18 additions & 0 deletions cli/cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,22 @@ func (gcp *GcpGenerateCommandExtraState) writeCache() {
}
}

type AzureGenerateCommandExtraState struct {
Output string
TerraformApply bool
}

func (a *AzureGenerateCommandExtraState) isEmpty() bool {
return a.Output == "" && !a.TerraformApply
}

// Flush current state of the struct to disk, provided it's not empty
func (a *AzureGenerateCommandExtraState) writeCache() {
if !a.isEmpty() {
cli.WriteAssetToCache(CachedAzureAssetExtraState, time.Now().Add(time.Hour*1), a)
}
}

var (
QuestionRunTfPlan = "Run Terraform plan now?"
QuestionUsePreviousCache = "Previous IaC generation detected, load cached values?"
Expand All @@ -76,10 +92,12 @@ func init() {
// Add cloud specific command flags
initGenerateAwsTfCommandFlags()
initGenerateGcpTfCommandFlags()
initGenerateAzureTfCommandFlags()

// add sub-commands to the iac-generate command
generateTfCommand.AddCommand(generateAwsTfCommand)
generateTfCommand.AddCommand(generateGcpTfCommand)
generateTfCommand.AddCommand(generateAzureTfCommand)
}

type SurveyQuestionWithValidationArgs struct {
Expand Down
Loading

0 comments on commit 73f8b0c

Please sign in to comment.