Skip to content

Fix --addon-database/--addon-redis flags being no-ops - #164

Merged
blsmth merged 1 commit into
mainfrom
agent/go-engineer/issue-163
Aug 6, 2026
Merged

Fix --addon-database/--addon-redis flags being no-ops#164
blsmth merged 1 commit into
mainfrom
agent/go-engineer/issue-163

Conversation

@blsmth

@blsmth blsmth commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Wires up the boolean --addon-database and --addon-redis flags on create app / create pipeline, which were previously registered but never read.

Changes:

  • Add DatabaseAddonEnabled / RedisAddonEnabled bool fields to AppStackParameters (cfnignore:"-" excludes them from CloudFormation parameters)
  • Interactive: AskForDatabase / AskForRedis default to yes when either the bool flag is set or a stack name is already configured; the no branch clears the flag
  • Non-interactive: new resolveAddonStacks helper (called from SetInternalFields) auto-selects when exactly one instance exists, errors with the list when multiple exist, and directs to apppack create database / apppack create redis when none exist
  • Add cfnignore tag support to StructToCloudformationParameters for CLI-only fields
  • Update flag help text to document the ordering constraint (create the instance first) and when --addon-database-name is needed
  • Table-driven unit tests for selectDatabaseStack, selectRedisStack, and the enable-default logic

Closes #163

Wire up the boolean --addon-database and --addon-redis flags so they are
no longer dead. Previously these flags were registered in cmd/create.go
but no struct field in AppStackParameters was bound to them, so passing
them alone had no effect.

Changes:
- Add DatabaseAddonEnabled and RedisAddonEnabled bool fields to
  AppStackParameters with cfnignore:"-" so they are excluded from
  CloudFormation parameter serialization (cli-only fields).
- AskForDatabase / AskForRedis now default the enable prompt to true
  when either the bool flag is set OR the stack name is already non-empty.
  The "no" branch also clears the bool flag to prevent resolveAddonStacks
  from re-enabling it after the user explicitly declined.
- Add resolveAddonStacks (called from SetInternalFields) which runs in
  both interactive and non-interactive flows. When --addon-database is set
  without --addon-database-name: if exactly one database exists on the
  cluster it is selected automatically; if multiple exist, the error lists
  the choices and instructs the user to pass --addon-database-name; if
  none exist, the error directs to `apppack create database`. Same logic
  for --addon-redis / --addon-redis-name / `apppack create redis`.
- Add cfnignore tag support to StructToCloudformationParameters so fields
  marked cfnignore:"-" are excluded from the CloudFormation parameter list.
- Update --addon-database / --addon-redis help text in cmd/create.go to
  make the "create the instance first" ordering constraint explicit and
  document when --addon-database-name is needed.
- Add table-driven unit tests for selectDatabaseStack, selectRedisStack,
  and the enable-default logic.

Closes #163
@blsmth

blsmth commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Live tested on apppack-sandbox ✅

Built this branch and ran it against the apppack-sandbox account (cluster apppack, one DB sandbox-db, one Redis sandbox-redis), using --check changesets so nothing was actually provisioned:

  • The fix — non-interactive bare --addon-database --addon-redis (no names) auto-resolved to DatabaseStackName=apppack-database-sandbox-db and RedisStackName=apppack-redis-sandbox-redis. This was previously a no-op.
  • No CFN leakage — the CLI-only DatabaseAddonEnabled/RedisAddonEnabled fields are absent from the changeset parameters, confirming cfnignore:"-" keeps them out of CloudFormation (they'd otherwise be rejected as unknown params).
  • Backward compat — explicit --addon-database-name sandbox-db still resolves correctly and leaves Redis empty.
  • Help text renders the new "instance must already exist" guidance.
  • Both test changeset stacks deleted afterward; no leftovers.

Multi-instance and zero-instance error paths are covered by the unit tests (couldn't exercise them live with only one instance of each on the sandbox cluster).

@blsmth
blsmth merged commit 3d97a12 into main Aug 6, 2026
3 of 4 checks passed
@blsmth
blsmth deleted the agent/go-engineer/issue-163 branch August 6, 2026 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--addon-database/--addon-redis flags on create app/create pipeline are no-ops

1 participant