Pulumi Service Provider

raw JSON →
0.39.0 verified Sat May 09 auth: no python

A native Pulumi package for managing Pulumi Cloud resources (e.g., stacks, environments, teams, webhooks, OIDC providers, RBAC roles). Current version 0.39.0, requires Python >=3.9. Release cadence: ~monthly.

pip install pulumi-pulumiservice
error ImportError: cannot import name 'PulumiServiceProvider' from 'pulumi_pulumiservice'
cause Wrong import path; the provider is not a separate class.
fix
Use: import pulumi_pulumiservice as pulumiservice
error pulumi.errors.ResourceError: 'pulumiservice:index:Stack' resource has a problem: Invalid access token
cause Missing or invalid access token for Pulumi Cloud.
fix
Set the access token via Pulumi config: pulumi config set pulumi-pulumiservice:access_token <token>
error pulumi.errors.ResourceError: 'pulumiservice:index:OrganizationRole' resource has a problem: expected 'kind' but got '__type'
cause Outdated schema; OrganizationRole discriminator changed from '__type' to 'kind'.
fix
Update your role permissions to use 'kind' instead of '__type'.
breaking In v0.33.0, PolicyGroup resource inputs changed: 'policyPacks' and 'stacks' items types changed from 'object' to specific references. Code using raw dicts will fail.
fix Use the new PolicyGroupPolicyPackReference and PolicyGroupStackReference types.
breaking In v0.38.0, OrganizationRole discriminator renamed from '__type' to 'kind'. Existing role definitions with '__type' will fail.
fix Update all OrganizationRole permissions to use 'kind' instead of '__type'.
gotcha The access_token must be provided via a resource option or config; hardcoding in source is insecure.
fix Use Pulumi config: pulumi config set pulumi-pulumiservice:access_token <token>
gotcha Environment names in TeamEnvironmentPermission must be unique across the org, not just the team. Duplicates cause refresh failures.
fix Ensure each environment name used in TeamEnvironmentPermission is globally unique.

Create a Pulumi Cloud stack resource.

import pulumi
import pulumi_pulumiservice as pulumiservice

config = pulumi.Config()
access_token = config.require('pulumi-access-token')

stack = pulumiservice.Stack('my-stack',
    org_name='my-org',
    project_name='my-project',
    stack_name='dev',
    opts=pulumi.ResourceOptions(provider=pulumiservice.Provider(access_token=access_token))
)

pulumi.export('stack_id', stack.id)