Skip to content

feat: use newest Hub modules for STACKIT - #9

Merged
grubmeshi merged 3 commits into
mainfrom
fix-stackit-metering
Aug 14, 2026
Merged

feat: use newest Hub modules for STACKIT#9
grubmeshi merged 3 commits into
mainfrom
fix-stackit-metering

Conversation

@Jelledb

@Jelledb Jelledb commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

This should fix custom metering not working moving forward

@grubmeshi

Copy link
Copy Markdown
Contributor

Taking this over. Rebased on main (which had moved on to ce25ec5) and pushed two commits.

The bump could not land as written

a93aba0 has no reference-architectures/stackit-sandbox-landingzone. 0ef0fdd merged it with stackit-hub-spoke into one stackit-landingzone that takes an optional network. tofu init fails with subdir "reference-architectures/stackit-sandbox-landingzone" not found, so the source path had to move too.

The rename shipped without moved blocks

Three resources change address between 942edaf and a93aba0, and the hub had no moved blocks for any of them. None of them live in this repo's state — they belong to the building block run, whose state meshStack holds — so tofu state mv here was not an option.

Old address New address What a replacement costs
stackit_resourcemanager_project.backplane …project.foundation Holds the project-creation service account. module.backplane keys it on the project id, and every tenant project names it as owner_email.
…meshstack_landingzone.stackit_default …meshstack_landingzone.this["default"] Tenants are assigned to it, and metadata.name is unchanged, so destroy and create collide on the same name.
…meshstack_building_block_definition.this …this["default"] Every tenant project building block instantiates it.

meshcloud/meshstack-hub#256 adds the moved blocks. This PR now pins f656771 from that branch instead of a93aba0. Re-pin to the merged main commit once #256 lands.

Plan against live state

Plan: 0 to add, 2 to change, 0 to destroy.
  # meshstack_building_block.stackit_sandbox_landingzone will be updated in-place
  # module.stackit_sandbox_landingzone.meshstack_building_block_definition.this will be updated in-place

Planned with a clean terragrunt cache and no provider dev override. The lock file needs no change.

Note that the building block instance also carries the role_mapping change (admin ownereditor) from 41a82cc, which was committed but never applied. That change is already pending on main today, independent of this PR.

Not applied — the apply and the building block run still need watching, because the moved blocks only take effect inside that run.

@grubmeshi

Copy link
Copy Markdown
Contributor

Checked the role mapping from 41a82cc with stackit project role list against the trial-metering project. The cap on editor is worth keeping, but the reason written in the comment was wrong, so 3d7caf4 rewrites it.

editor can delete the project just like owner

Both roles carry resource-manager.project.delete. Capping admins at editor does not stop a tenant from deleting the project out from under meshStack. Only reader lacks the permission, and reader is no use to someone meant to build in the project.

Role Permissions Has resource-manager.project.delete
reader 349 no
editor 809 yes
owner 842 yes

What the cap does buy

owner holds 33 permissions editor does not. The ones that matter here are iam.member.add, iam.member.remove, iam.role.add, iam.role.edit, iam.role.remove and the per-product role-binding permissions (vpc.role-binding.*, secrets-manager.*.role-binding.*, data-catalog.instance.policy.administer).

Without them a tenant cannot grant STACKIT access to people meshStack does not know about. That matters because stackit_authorization_project_role_assignment in the project building block is a for_each over meshStack's own project members only, so an assignment made by hand is invisible to it and survives every later run.

The remainder of the 33 are incidental: argus.grafana.*administrate, mailout.sending-domain.*, postgres-flex.instance.force-delete, mongodb-flex.project.delete, telemetry-link.instance.*, support.assume-role.*, model-experiments.instance.login, sqlserver-flex.instance.protect.

Two things to be aware of

role_mapping is a STATIC input on the STACKIT Project definition, in both the old and the new hub ref. It is not a default tenants can override, so every existing tenant picks the new value up on its next run: each admin's alice@example.com:owner assignment is destroyed and alice@example.com:editor created. No project or resource is touched, but current trial admins are demoted.

After the change admin and user both map to editor, so the two meshStack roles are indistinguishable inside STACKIT.

If protecting the project from deletion is actually wanted, this mapping is not the lever. resource-manager.lock.* is in editor too, so a tenant could remove a lock as easily as set one. It would need a custom STACKIT role.

Plan is unchanged: 0 to add, 2 to change, 0 to destroy.

setup-env.sh opens a port-forward and a Vault login on every shell, which is slow when you run
several units in a row. Caching its output in a gitignored .env and sourcing that instead is much
faster, so keep the file out of the repo.
@grubmeshi
grubmeshi force-pushed the fix-stackit-metering branch from 583ad14 to b0bc69c Compare August 14, 2026 03:40
grubmeshi and others added 2 commits August 14, 2026 05:45
…cord the gap it leaves

41a82cc capped meshStack admins at the STACKIT `editor` role and said `owner` had to go because it
permits deleting the project out from under meshStack. `stackit project role list` says otherwise:
`editor` carries resource-manager.project.delete just as `owner` does, so the cap never protected
the project. Only `reader` lacks the permission, and a sandbox user cannot work with `reader`.

What the cap does buy is worth keeping. Of the 33 permissions `owner` holds and `editor` does not,
the ones that matter here are iam.member.add, iam.member.remove, iam.role.add, iam.role.edit,
iam.role.remove and the per-product role-binding permissions. Without them a tenant cannot grant
STACKIT access to people meshStack does not know about, which matters because the project building
block writes role assignments only for meshStack's own project members, so anything granted by hand
would stay invisible to it and survive every later run.

The deletion gap is now written down rather than assumed closed. A tenant that deletes its project
leaves the STACKIT Project building block managing a project that is gone: the block's state still
names it, and its next run fails or recreates it. Closing that needs a custom role, because STACKIT
cannot subtract a permission from a built-in one and no data source reads a built-in role's
permissions, so the custom role would have to carry `editor`'s other 808 names and be refreshed
whenever STACKIT ships a service. Skipped: the list would rot silently and cost trial users access
to new services, while the damage a tenant can do reaches no further than its own sandbox.

Counts are from `stackit project role list` against the trial-metering project: reader 349
permissions, editor 809, owner 842.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This should fix custom metering not working moving forward: the hub adds the metering object to the
STACKIT platform, without which meshStack generates no TURPs from pushed resource usage reports.

The hub merged reference-architectures/stackit-sandbox-landingzone and stackit-hub-spoke into one
stackit-landingzone that takes an optional `network`, so there is no directory at the old source
path any more and `tofu init` fails on it. Leaving `network` unset keeps this deployment
sandbox-only.

That rename came without moved blocks, which would have destroyed and recreated three resources in
the building block run: the backplane project holding the project-creation service account, the
landing zone its tenants are assigned to, and the `STACKIT Project` definition every tenant project
instantiates. None of them live in this repo's state, so meshcloud/meshstack-hub#256 adds the moved
blocks and this pins f656771 rather than a93aba0, the tip of hub main. Re-pin once #256 merges.

Planned against live state: 0 to add, 2 to change, 0 to destroy. Both changes are in place, the
definition and the building block instance. The instance also carries the role_mapping change from
41a82cc, which was committed but never applied.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@grubmeshi
grubmeshi force-pushed the fix-stackit-metering branch from b0bc69c to e61d43e Compare August 14, 2026 03:46
@grubmeshi
grubmeshi merged commit e61d43e into main Aug 14, 2026
grubmeshi added a commit that referenced this pull request Aug 17, 2026
41a82cc capped meshStack admins at the STACKIT `editor` role and PR #9 applied that cap. It works
against what this landing zone is for. The sandbox is an open landing zone: real people should be
able to use STACKIT freely, which includes granting access to others and escalating privileges
through service accounts. `editor` withholds iam.member.add, iam.role.add and the per-product
role-binding permissions, so it blocks exactly that.

Applied to the trial foundation: 0 to add, 1 to change, 0 to destroy, the role_mapping input on the
landing zone building block. The nested `STACKIT Project` definition takes role_mapping as a STATIC
input, so tenant projects pick `owner` up on their next building block run.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

2 participants