From 100f402ac801badb56aa980e1572510a022bd2db Mon Sep 17 00:00:00 2001 From: hc-github-team-secure-vault-core <82990506+hc-github-team-secure-vault-core@users.noreply.github.com> Date: Fri, 16 Jun 2023 17:33:30 -0400 Subject: [PATCH] backport of commit 3908ec9dc44352548e08f4c86f9ad76c255ce493 (#21331) Co-authored-by: Anton Averchenkov <84287187+averche@users.noreply.github.com> --- changelog/21297.txt | 3 +++ command/agent_generate_config.go | 3 ++- .../docs/agent-and-proxy/agent/generate-config/index.mdx | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 changelog/21297.txt diff --git a/changelog/21297.txt b/changelog/21297.txt new file mode 100644 index 000000000..9f98fd3e0 --- /dev/null +++ b/changelog/21297.txt @@ -0,0 +1,3 @@ +```release-note:bug +agent: Fix agent generate-config to accept -namespace, VAULT_NAMESPACE, and other client-modifying flags. +``` diff --git a/command/agent_generate_config.go b/command/agent_generate_config.go index 5c42d0e59..4c25b443d 100644 --- a/command/agent_generate_config.go +++ b/command/agent_generate_config.go @@ -87,7 +87,8 @@ Usage: vault agent generate-config [options] [path/to/config.hcl] } func (c *AgentGenerateConfigCommand) Flags() *FlagSets { - set := NewFlagSets(c.UI) + // Include client-modifying flags (-address, -namespace, etc.) + set := c.flagSet(FlagSetHTTP) // Common Options f := set.NewFlagSet("Command Options") diff --git a/website/content/docs/agent-and-proxy/agent/generate-config/index.mdx b/website/content/docs/agent-and-proxy/agent/generate-config/index.mdx index f02cd8e12..ebe5f234f 100644 --- a/website/content/docs/agent-and-proxy/agent/generate-config/index.mdx +++ b/website/content/docs/agent-and-proxy/agent/generate-config/index.mdx @@ -49,6 +49,7 @@ Generate an agent configuration file which will reference `secret/foo`: $ vault agent generate-config \ -type="env-template" \ -exec="./my-app arg1 arg2" \ + -namespace="my/ns/" \ -path="secret/foo" \ my-config.hcl