Skip to content

Update `gitlab_project_protected_environment` deploy_access_level attribute to use SetNestedAttribute instead of SetNestedBlock

As part of adding approval rules to project_protected_environment, we learned that the SetNestedBlock resource is only supported for legacy reasons, and that ListNestedAttribute was much more reliable when determining diffs. As a result, we updated the approval rules to use ListNestedAttribute instead of SetNestedBlock.

This issue is for updating the deploy blocks to use the same syntax (but unordered, using SetNestedAttribute). While we would normally attempt to create a new attribute and deprecate the existing one (you can see efforts related to this in !1708 (closed)), this caused issues with the pre-existing attribute since Block attributes cannot have a computed parameter in them. As a result, import and read operations didn't work well when attempting to deprecate and replace.

As a result, we're left with a "Big Bang" migration where we unfortunately need to make a breaking change without a pre-migration path in %17.0 .

Implementation:

  • Create a state migration from v0 -> v1, migrating the deploy_access_level attributes
  • Update deploy_access_level from SetNestedBlock to SetNestedAttribute
Edited by Patrick Rice