Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix s3bucket option for stackset deploy #593

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/cmd/rain/rain.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func init() {
addCommand(stackGroup, true, false, ls.Cmd)
addCommand(stackGroup, true, false, rm.Cmd)
addCommand(stackGroup, true, false, watch.Cmd)
addCommand(stackGroup, true, true, stackset.StackSetCmd)
addCommand(stackGroup, true, false, stackset.StackSetCmd)

// Template commands
addCommand(templateGroup, true, true, bootstrap.Cmd)
Expand Down
14 changes: 10 additions & 4 deletions internal/cmd/stackset/stackset.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package stackset

import (
"github.com/aws-cloudformation/rain/internal/aws/s3"
"github.com/aws-cloudformation/rain/internal/config"
"github.com/aws-cloudformation/rain/internal/console"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -33,11 +34,16 @@ Use "{{.CommandPath}} [command] --help" for more information about a command.{{e
var delegatedAdmin bool

// addCommand adds a command to the root command.
func addCommand(profileOptions bool, c *cobra.Command) {
func addCommand(profileOptions bool, bucketOptions bool, c *cobra.Command) {
if profileOptions {
c.Flags().StringVarP(&config.Profile, "profile", "p", "", "AWS profile name; read from the AWS CLI configuration file")
c.Flags().StringVarP(&config.Region, "region", "r", "", "AWS region to use")
}
if bucketOptions {
c.Flags().StringVar(&s3.BucketName, "s3-bucket", "", "Name of the S3 bucket that is used to upload assets")
c.Flags().StringVar(&s3.BucketKeyPrefix, "s3-prefix", "", "Prefix to add to objects uploaded to S3 bucket")
c.Flags().StringVar(&s3.ExpectedBucketOwner, "s3-owner", "", "The account where S3 assets are stored")
}

c.Flags().BoolVar(&delegatedAdmin, "admin", false, "Use delegated admin permissions")

Expand All @@ -51,9 +57,9 @@ var StackSetCmd = &cobra.Command{
}

func init() {
addCommand(true, LsCmd)
addCommand(true, DeployCmd)
addCommand(true, RmCmd)
addCommand(true, false, LsCmd)
addCommand(true, true, DeployCmd)
addCommand(true, false, RmCmd)

oldUsageFunc := StackSetCmd.UsageFunc()
StackSetCmd.SetUsageFunc(func(c *cobra.Command) error {
Expand Down
Loading