Skip to content

Add generic tags ops file - #534

Merged
rkoster merged 2 commits into
developfrom
add-generic-tags-ops
Sep 24, 2026
Merged

rkoster merged 2 commits into
developfrom
add-generic-tags-ops

Conversation

@ramonskie

@ramonskie ramonskie commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds misc/tags.yml, a reusable ops file that applies a map of deployment tags to every instance in a deployment via the top-level BOSH tags key.

The BOSH director forwards deployment tags to the CPI as instance metadata. On GCP the google CPI surfaces them as resource labels (visible in cost/billing reports); other CPIs map them onto their own resource metadata (for example AWS EC2 tags). The file takes a single deployment_tags map variable, so it is not tied to a particular key schema and can be shared by any deployment/pipeline.

# misc/tags.yml
- type: replace
  path: /tags?
  value: ((deployment_tags))

Why deployment_tags and not tags

bosh-deployment's CPI ops files already use a tags variable for VM network tags, which are a list (gcp/cpi.yml, gcp/cloud-config.yml, and jumpbox-deployment). Reusing tags for the deployment tag map collides: with one tags value supplied, both interpolations cannot be satisfied (list vs map). deployment_tags keeps the two independent.

Usage

bosh deploy ... -o bosh-deployment/misc/tags.yml \
  -v 'deployment_tags={"pipeline":"bosh-deployment","environment":"my-env"}'

or with a vars file:

# tags.yml
deployment_tags:
  pipeline: bosh-deployment
  environment: my-env
bosh deploy ... -o bosh-deployment/misc/tags.yml --vars-file tags.yml

Any tags defined directly in the deployment manifest are replaced by this ops file.

Verification

Local bosh 7.10.11:

  • bosh interpolate misc/tags.yml → exit 0 (passes the find . -name '*.yml' | xargs bosh interpolate syntax check in tests/run-checks.sh)
  • manifest without tags + this ops file → tags: created with the supplied map
  • manifest with existing tags + this ops file → replaced by the supplied map
  • both -v 'deployment_tags={...}' (JSON map) and --vars-file interpolate correctly
  • coexists with a separate -v 'tags=["..."]' network-tags value (the previous collision) without conflict

Notes

  • Pairs with cloudfoundry/bosh-bootloader#694, which lets bbl label the director/jumpbox VMs and its terraform resources. This ops file is for the resources created by deployments (for example CF, Concourse) run against a director.

Adds misc/tags.yml, a reusable ops file that applies a map of tags to every
instance in a deployment through the top-level tags key.

The BOSH director forwards deployment tags to the CPI as instance metadata.
On GCP the google CPI surfaces them as resource labels (visible in
cost/billing reports); other CPIs map them onto their own resource metadata
(for example AWS EC2 tags). The file takes a single tags map variable so it
is not tied to a particular key schema and can be shared by any deployment.

Usage:

  bosh deploy ... -o misc/tags.yml --vars-file tags.yml
@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: a8c8c69e-351d-4d45-9649-4e03b3cb7546

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@benjaminguttmann-avtq benjaminguttmann-avtq left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

`tags` is already used by the CPI ops files (gcp/cpi.yml, gcp/cloud-config.yml)
for VM network tags, which are a list. Reusing the same name for the deployment
tag map collides: when a single `tags` value is supplied, both interpolations
cannot be satisfied (list vs map).

Rename the variable to `deployment_tags` and correct the usage docs: a JSON map
can be passed with `-v`, not only with `--vars-file`.

Also note the variable choice in the README entry.
@rkoster
rkoster merged commit c0422bb into develop Sep 24, 2026
4 checks passed
@rkoster
rkoster deleted the add-generic-tags-ops branch September 24, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants