diff --git a/.changelog/16437.txt b/.changelog/16437.txt new file mode 100644 index 000000000..2844bac4a --- /dev/null +++ b/.changelog/16437.txt @@ -0,0 +1,3 @@ +```release-note:improvement +cli: `acl token create` will now emit a warning if the token has a policy that does not yet exist +``` diff --git a/command/acl_token_create.go b/command/acl_token_create.go index 5007839c8..70c09efd6 100644 --- a/command/acl_token_create.go +++ b/command/acl_token_create.go @@ -154,6 +154,14 @@ func (c *ACLTokenCreateCommand) Run(args []string) int { return 1 } + // Show warning if policy doesn't exist + for _, policy := range tk.Policies { + _, _, err := client.ACLPolicies().Info(policy, nil) + if err != nil { + c.Ui.Warn(fmt.Sprintf("Error fetching info on %s policy: %s", policy, err)) + } + } + // Create the bootstrap token token, _, err := client.ACLTokens().Create(tk, nil) if err != nil {