-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdiff.go
24 lines (21 loc) · 921 Bytes
/
diff.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package main
import (
"github.com/kim0/tfstoys/pkgs/app"
"github.com/spf13/cobra"
)
func init() {
diffCmd.Flags().UintVarP(&days, "days", "d", 0, `Number of days to consider as gap. Used to compare most recent versions
before and after the gap. The default of zero shows interactive version picker`)
diffCmd.Flags().StringVarP(&state_bucket, "bucket", "b", "brave-devops-remote-state-production", "Name of the S3 remote state bucket")
diffCmd.Flags().StringVarP(&state_path, "path", "p", "", "ex: website/foo.com/production. If undefined, shows interactive picker")
rootCmd.AddCommand(diffCmd)
}
var diffCmd = &cobra.Command{
Use: "diff",
Short: "Performs diff operation on two TF state versions",
Long: `Diff two TF state versions stored on S3`,
Run: func(cmd *cobra.Command, args []string) {
since_strategy := app.Since_Strategy{Days: days}
app.Diff(state_bucket, state_path, since_strategy)
},
}