fix(resource/scalingo_scm_repo_link): don't omit attributes anymore when creating repo link with review apps disabled #159
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue description
This PR solves a problem I encountered recently: when creating a repo link using the resource
scalingo_scm_repo_link
while thedeploy_review_apps_enabled = false
, the propertiesdelete_on_close_enabled
,delete_stale_enabled
,hours_before_delete_on_close
andhours_before_delete_stale
are not configured by the create operation, so what is configured in the Scalingo API and therefore in the Terraform state does not conform to what is written in the HCL code.Here's an example:
The
terraform plan
command will propose the creation of this repo link:Next, let's use the
terraform apply
command, then redo theterraform plan
to understand what happened, or rather what didn't happen as expected:It is only after a second execution of the
terraform apply
command that the properties have been properly configured:Issue resolution
This problem is due to a condition in the code, which is not necessary according to the API documentation. I therefore propose that the Terraform provider should not try to be smarter than the API, and should allow all properties to be configured, whether
deploy_review_apps_enabled
is enabled or not (especially as the auto-removal features continue to work on manually deployed review apps).I look forward to seeing your feedback on this PR.