diff --git a/cmd/deploy.go b/cmd/deploy.go index a6e356b..d46f4d3 100644 --- a/cmd/deploy.go +++ b/cmd/deploy.go @@ -75,6 +75,7 @@ var deploy_NonInteractive *bool var deploy_CreateChangeset *bool var deploy_DeployChangeset *bool var deploy_DefaultTags *bool +var deploy_DeploymentFile *string var deployment lib.DeployInfo func init() { @@ -90,6 +91,7 @@ func init() { deploy_CreateChangeset = deployCmd.Flags().Bool("create-changeset", false, "Only create a change set") deploy_DeployChangeset = deployCmd.Flags().Bool("deploy-changeset", false, "Deploy a specific change set") deploy_DefaultTags = deployCmd.Flags().Bool("default-tags", true, "Add any default tags that are specified in your config file") + deploy_DeploymentFile = deployCmd.Flags().StringP("deployment-file", "d", "", "The file to use for the deployment") } func deployTemplate(cmd *cobra.Command, args []string) { @@ -106,6 +108,10 @@ func deployTemplate(cmd *cobra.Command, args []string) { if err != nil { failWithError(err) } + if *deploy_DeploymentFile != "" && (*deploy_Template != "" || *deploy_Parameters != "" || *deploy_Tags != "") { + outputsettings.StringFailure("You can't provide a deployment file and other parameters at the same time") + os.Exit(1) + } deployment.IsNew = deployment.IsNewStack(awsConfig.CloudformationClient()) if !deployment.IsNew { if ready, status := deployment.IsReadyForUpdate(awsConfig.CloudformationClient()); !ready { diff --git a/lib/files.go b/lib/files.go index 01afec7..f6a0a6c 100644 --- a/lib/files.go +++ b/lib/files.go @@ -55,6 +55,10 @@ func ReadParametersfile(parametersName string) (string, string, error) { return ReadFile(¶metersName, "parameters") } +func ReadDeploymentFile(deploymentmentFileName string) (string, string, error) { + return ReadFile(&deploymentmentFileName, "deployments") +} + func UploadTemplate(templateName *string, template string, bucketName *string, svc *s3.Client) (string, error) { // use the template name with a timestamp that should be unique // prefix with fog to make it easier to set up specific lifecycle rules