How do I update a stack's URL to match its display name?
Last updated: July 14, 2025
Context
When a stack's display name is changed through Terraform or the UI, the stack's URL and internal ID remain unchanged. This can lead to inconsistencies between how the stack appears in the UI and its URL/references, particularly in external checks or integrations.
Answer
To update a stack's URL (slug) to match its display name, you'll need to use the Spacelift API's stackReslug mutation. This cannot be done through Terraform or the UI directly.
Here's how to update the stack's URL:
Get your stack's current ID by either:
Copying it from the stack's URL
Going to the stack in the UI, clicking the three dots menu (⋮), and selecting "Copy ID"
Use the following API mutation:
mutation ReslugStack($stackId: ID!) { stackReslug(id: $stackId) { id name } }Include the query variables:
{ "stackId": "your-stack-id" }
Warning: Before performing this operation, be aware that:
If you reference this stack by ID in Terraform resources, those resources will need to be recreated
Resources like environment variables or integrations that reference the stack ID will be affected
The new URL/slug will be automatically generated based on the current stack name
Source: Spacelift API Documentation