-
Notifications
You must be signed in to change notification settings - Fork 10
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
Avoid config re-creation on environment rename #45
Comments
Hi @rvoitenko, thanks for reaching out about this! This is certainly a confusing and unintuitive scenario. For convenience, our public API endpoints for environments and configs reference projects by name, rather than by an immutable identifier. Our Terraform provider therefore can't tell the difference between a project rename and an attempt to move an environment from one project to another (which would absolutely require re-creation of the environment resource). I'll chat with the team on some ways to solve this but we unfortunately don't have a good workaround at the moment. Sorry for the confusion! |
But why environment name is immutable? For example I had this code: resource "doppler_project" "project1" {
name = "project1"
}
resource "doppler_environment" "prod" {
project = "project1"
slug = "prod"
name = "prod"
}
resource "doppler_config" "prod_gh" {
project = "project1"
environment = "prod"
name = "prod_gh"
} and I want to rename resource "doppler_project" "project1" {
name = "project1"
}
resource "doppler_environment" "prod" {
project = "project1"
slug = "prd"
name = "prd"
}
resource "doppler_config" "prod_gh" {
project = "project1"
environment = "prd"
name = "prd_gh"
} And this causes config to be recreated. |
Doppler projects, environments, and configs can all be renamed via the Doppler Dashboard or API. However, the Doppler API (and the Terraform provider by extension) associates these resources with their parents via the name of the parent. In your example, This scenario is definitely nuanced so please let me know if there's more I can clarify! The import solution is interesting. I'll chat with the team about that. Ideally though, you'd be able to perform this operation in Terraform alone. |
Thank you for your explanation. |
Thanks for that example! We'll take a closer look at the GitHub provider for reference. The Doppler API doesn't have an immutable public identifier for projects today but it's something that could be added. |
I had a project with a few envs and configs, created by terraform.
Then I added secrets in configs and github integration.
At some point I decided to rename the project in terraform. Terraform did rename the project but also re-created all envs/configs. So all secrets were removed, and integrations were as well.
Example code:
Then I renamed
prod
environment toprd
:This caused
prod_gh
config to be re-created and all secrets in it were removed as well.Expected behavior: envs updated in-place(renamed), without impact on configs.
The text was updated successfully, but these errors were encountered: