Add ability to skip automatic auth method creation (#306)
This is useful if you, for instance, want Terraform to be 100% responsible for creation of resources (outside of the static ones that cannot be removed or modified, like u_anon). This will mean using the recovery mechanism for initial setup, but that isn't an issue once TF supports that :-)
This commit is contained in:
1 parent
490be8a7e4
commit
b53812a5c1
6 files changed
+111
-56
No files matched your search
@@ -44,8 +44,8 @@ type Command struct {
|
||||
flagDevPassword string
|
||||
flagDevControllerAPIListenAddr string
|
||||
flagDevControllerClusterListenAddr string
|
||||
flagDevOrgId string
|
||||
flagDevAuthMethodId string
|
||||
flagDevSkipAuthMethodCreation bool
|
||||
}
|
||||
|
||||
func (c *Command) Synopsis() string {
|
||||
@@ -108,14 +108,6 @@ func (c *Command) Flags() *base.FlagSets {
|
||||
"production.",
|
||||
})
|
||||
|
||||
f.StringVar(&base.StringVar{
|
||||
Name: "dev-org-id",
|
||||
Target: &c.flagDevOrgId,
|
||||
EnvVar: "WATCHTWER_DEV_ORG_ID",
|
||||
Usage: "Auto-created org ID. This only applies when running in \"dev\" " +
|
||||
"mode.",
|
||||
})
|
||||
|
||||
f.StringVar(&base.StringVar{
|
||||
Name: "dev-auth-method-id",
|
||||
Target: &c.flagDevAuthMethodId,
|
||||
@@ -124,6 +116,12 @@ func (c *Command) Flags() *base.FlagSets {
|
||||
"mode.",
|
||||
})
|
||||
|
||||
f.BoolVar(&base.BoolVar{
|
||||
Name: "dev-skip-auth-method-creation",
|
||||
Target: &c.flagDevSkipAuthMethodCreation,
|
||||
Usage: "If set, an auth method will not be created as part of the dev instance. The recovery KMS will be needed to perform any actions.",
|
||||
})
|
||||
|
||||
f.StringVar(&base.StringVar{
|
||||
Name: "dev-password",
|
||||
Target: &c.flagDevPassword,
|
||||
@@ -275,7 +273,17 @@ func (c *Command) Run(args []string) int {
|
||||
}
|
||||
|
||||
if c.flagDev {
|
||||
if err := c.CreateDevDatabase("postgres"); err != nil {
|
||||
var opts []base.Option
|
||||
if c.flagDevSkipAuthMethodCreation {
|
||||
opts = append(opts, base.WithSkipAuthMethodCreation())
|
||||
switch {
|
||||
case c.flagDevAuthMethodId != "",
|
||||
c.flagDevLoginName != "",
|
||||
c.flagDevPassword != "":
|
||||
c.UI.Warn("-dev-skip-auth-method-creation set, skipping any auth-method related flags")
|
||||
}
|
||||
}
|
||||
if err := c.CreateDevDatabase("postgres", opts...); err != nil {
|
||||
c.UI.Error(fmt.Errorf("Error creating dev database container: %s", err.Error()).Error())
|
||||
return 1
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user