The deployment-resource is a rather seldom used but very useful resource.
Unfortunately the bitbucket-devs were a bit lazy with the requirements of this and didn't even bother to create a proper documentation of the actual response.
This lead to the confusing situation that the API respond with two different fields for the rank, one in the root of the response and one as part of environment_type. When you're going to create a deployment with the terraform-resource this is fine, because both occurences are going to be changed. But if you've set the rank through the UI, only the rank within environment_type is changed!
If you then try to import a resource through terraform import it's impossible to import them correctly without a change!
The
The simpliest solution to address this issue is a change of the attached line to look for deployment.EnvironmentType.Rank. As I said it doesn't change the behavior of a deployment created with this resource but enables a clean import!
The deployment-resource is a rather seldom used but very useful resource. Unfortunately the bitbucket-devs were a bit lazy with the requirements of this and didn't even bother to create a proper documentation of the actual response.
This lead to the confusing situation that the API respond with two different fields for the
rank
, one in the root of the response and one as part ofenvironment_type
. When you're going to create a deployment with the terraform-resource this is fine, because both occurences are going to be changed. But if you've set the rank through the UI, only the rank withinenvironment_type
is changed!If you then try to import a resource through
terraform import
it's impossible to import them correctly without a change!The The simpliest solution to address this issue is a change of the attached line to look for
deployment.EnvironmentType.Rank
. As I said it doesn't change the behavior of a deployment created with this resource but enables a clean import!https://github.com/zahiar/terraform-provider-bitbucket/blob/49edc9f32c07af741307980e9dd421d4880c6935/bitbucket/resource_bitbucket_deployment.go#L99-L101
A sample for such an UI created deployment might look like this:
While a deployment via the resource might look like this:
The only diff is the
rank
on the root (and obviously the uuid).