github.com/GoogleCloudPlatform/terraformer@v0.8.18/cmd/provider_cmd_octopusdeploy.go (about) 1 package cmd 2 3 import ( 4 octopusdeploy_terraforming "github.com/GoogleCloudPlatform/terraformer/providers/octopusdeploy" 5 6 "github.com/GoogleCloudPlatform/terraformer/terraformutils" 7 "github.com/spf13/cobra" 8 ) 9 10 func newCmdOctopusDeployImporter(options ImportOptions) *cobra.Command { 11 var server, apiKey string 12 cmd := &cobra.Command{ 13 Use: "octopusdeploy", 14 Short: "Import current state to Terraform configuration from Octopus Deploy", 15 Long: "Import current state to Terraform configuration from Octopus Deploy", 16 RunE: func(cmd *cobra.Command, args []string) error { 17 provider := newOctopusDeployProvider() 18 options.PathPattern = "{output}/{provider}/" 19 err := Import(provider, options, []string{server, apiKey}) 20 if err != nil { 21 return err 22 } 23 return nil 24 }, 25 } 26 27 cmd.AddCommand(listCmd(newOctopusDeployProvider())) 28 baseProviderFlags(cmd.PersistentFlags(), &options, "octopusdeploy", "tagset") 29 cmd.PersistentFlags().StringVar(&server, "server", "", "Octopus Server's API endpoint or env param OCTOPUS_CLI_SERVER") 30 cmd.PersistentFlags().StringVar(&apiKey, "apikey", "", "Octopus API key or env param OCTOPUS_CLI_API_KEY") 31 return cmd 32 } 33 34 func newOctopusDeployProvider() terraformutils.ProviderGenerator { 35 return &octopusdeploy_terraforming.OctopusDeployProvider{} 36 }