-
Notifications
You must be signed in to change notification settings - Fork 6
feat: add StackTags resource for managing multiple stack tags #548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
af86c83 to
148ea82
Compare
Does the PR have any schema changes?Looking good! No breaking changes found. New resources:
Maintainer note: consult the runbook for dealing with any breaking changes. |
babd800 to
ad76dd1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new StackTags resource that allows managing multiple stack tags as a single resource, improving the user experience especially for YAML users who can now define tags as a map rather than creating individual StackTag resources for each tag.
- Introduces
pulumiservice:index:StackTagsresource with map-based tag management - Adds helper method
GetStackTags()to API client for retrieving all stack tags - Implements complete CRUD operations with proper diff detection and replace-on-change behavior
- Includes comprehensive unit tests and integration test with YAML example
Reviewed Changes
Copilot reviewed 19 out of 21 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/python/pulumi_pulumiservice/stack_tags.py | Generated Python SDK bindings for StackTags resource |
| sdk/python/pulumi_pulumiservice/init.py | Registers StackTags in Python SDK exports |
| sdk/nodejs/stackTags.ts | Generated Node.js SDK bindings for StackTags resource |
| sdk/nodejs/index.ts | Registers StackTags in Node.js SDK exports |
| sdk/go/pulumiservice/stackTags.go | Generated Go SDK bindings for StackTags resource |
| sdk/dotnet/StackTags.cs | Generated .NET SDK bindings for StackTags resource |
| provider/pkg/util/property_map.go | Adds map[string]string support to property conversion utilities |
| provider/pkg/resources/stack_tags_plural.go | Core StackTags resource implementation with CRUD operations |
| provider/pkg/pulumiapi/stack_tags.go | Adds GetStackTags helper method to API client |
| provider/cmd/pulumi-resource-pulumiservice/schema.json | Schema definition for StackTags resource |
| examples/yaml-stack-tags-plural/Pulumi.yaml | YAML example demonstrating StackTags usage |
Comments suppressed due to low confidence (1)
examples/yaml-stack-tags-plural/Pulumi.yaml:1
- Corrected spelling of 'it's' to 'its'.
name: yaml-stack-tags-plural-example
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
ad76dd1 to
ad68215
Compare
|
@komalali I tagged you in on the review as you re-opened the ticket. Does this fit the ticket? |
|
for my own education, why is StackTag its own resource, rather than |
I think it's because the stack is created via the cli, and these are appended to it: https://www.pulumi.com/docs/pulumi-cloud/reference/stack-tags/ |
4efbe4e to
a860ca3
Compare
Add a new `StackTags` resource that allows managing multiple stack tags
as a single resource, improving the user experience especially for YAML
users who can now define tags as a map rather than creating individual
StackTag resources for each tag.
- **Schema**: Added `pulumiservice:index:StackTags` resource definition
with support for map[string]string tags property
- **API Client**: Added `GetStackTags()` helper method to retrieve all
stack tags at once
- **Resource Implementation**: Created `PulumiServiceStackTagsResource`
with full CRUD support:
- Create: Iterates through tags map and creates each tag
- Read: Retrieves all stack tags and filters to managed set
- Update: Calculates diff (add/remove/modify) and applies changes
- Delete: Removes all managed tags
- Diff: Detects changes with proper replace-on-change for org/project/stack
- **Provider Registration**: Registered new resource in provider
- **Unit Tests**: Added comprehensive unit tests for all CRUD operations
- **Integration Test**: Added YAML example and test case demonstrating usage
The StackTags resource manages multiple tags as a unit while respecting
tag immutability in the Pulumi Cloud API. Tag value changes are handled
by deleting the old tag and creating a new one. The resource tracks which
tags it manages in state to avoid interfering with tags created by other
resources or manual operations.
```yaml
stackTags:
type: pulumiservice:StackTags
properties:
organization: my-org
project: my-project
stack: my-stack
tags:
environment: production
team: platform
cost-center: engineering
```
A complete working example is available in `examples/yaml-stack-tags-plural/`
and tested in `TestYamlStackTagsPluralExample`.
Fixes #61
a860ca3 to
6ac33e6
Compare
Add a new
StackTagsresource that allows managing multiple stack tags as a single resource, improving the user experience especially for YAML users who can now define tags as a map rather than creating individual StackTag resources for each tag.Changes
pulumiservice:index:StackTagsresource definition with support for map[string]string tags propertyGetStackTags()helper method to retrieve all stack tags at oncePulumiServiceStackTagsResourcewith full CRUD support:Implementation Details
The StackTags resource manages multiple tags as a unit while respecting tag immutability in the Pulumi Cloud API. Tag value changes are handled by deleting the old tag and creating a new one. The resource tracks which tags it manages in state to avoid interfering with tags created by other resources or manual operations.
Example Usage
A complete working example is available in
examples/yaml-stack-tags-plural/and tested inTestYamlStackTagsPluralExample.Fixes #61