Skip to content

Conversation

@nemoinho
Copy link

The documentation from bitbucket is actually not that good, because it doesn't explain any of the fields in question. However I observed on the bitbucket-cloud instance that the previous implementation lead to errors during imports of deployment configurations into a terraform state.

Steps to reproduce the error:

  1. Create a repository in bitbucket-cloud
  2. Create a deployment for the repository via GUI for Production or Staging (not Test!)
  3. write a terraform module (which exactly matches the deployment) and perform terraform import to import the existing deployment into the terraform state
  4. perform terraform apply and terraform wants to change the resource!

This change reads the rank from the environment_type which is the only valid source if the deployment was created via UI and still a valid source for a deployment which was created via this provider.

Reference: https://developer.atlassian.com/cloud/bitbucket/rest/api-group-deployments/#api-repositories-workspace-repo-slug-environments-environment-uuid-get-response
Closes: #186

The documentation from bitbucket is actually not that good, because it
doesn't explain any of the fields in question. However I observed on the
bitbucket-cloud instance that the previous implementation lead to errors
during imports of deployment configurations into a terraform state.

Steps to reproduce the error:
1. Create a repository in bitbucket-cloud
2. Create a deployment for the repository via GUI for Production or
   Staging (not Test!)
3. write a terraform module (which exactly matches the deployment) and
   perform `terraform import` to import the existing deployment into the
   terraform state
4. perform `terraform apply` and terraform wants to change the resource!

This change reads the rank from the `environment_type` which is the only
valid source if the deployment was created via UI and still a valid
source for a deployment which was created via this provider.

Reference: https://developer.atlassian.com/cloud/bitbucket/rest/api-group-deployments/#api-repositories-workspace-repo-slug-environments-environment-uuid-get-response
Closes: zahiar#186
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use the Rank from the environmentType when reading a deployment to allow valid imports of bitbucket_deployment

1 participant