aptible / terraform-provider-aptible

The official Terraform provider for Aptible Deploy
https://registry.terraform.io/providers/aptible/aptible/latest
10 stars 13 forks source link

Fix issue with scaling when it isn't necessary #89

Closed joshraker closed 1 year ago

joshraker commented 1 year ago

If the App's state changed but none of the services did, every service was being scaled to the existing container count, size, and profile.

joshraker commented 1 year ago

Integration tests are passing.

==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -count 1 -parallel 20 -run TestAccResourceApp -timeout 120m
?       github.com/aptible/terraform-provider-aptible   [no test files]
=== RUN   TestAccResourceApp_basic
--- PASS: TestAccResourceApp_basic (10.87s)
=== RUN   TestAccResourceApp_deploy
Still creating...
Still creating...
Still creating...
Done!
Still creating...
Still creating...
Still creating...
Done!
Still creating...
--- PASS: TestAccResourceApp_deploy (43.74s)
=== RUN   TestAccResourceApp_updateConfig
Still creating...
Still creating...
Still creating...
Done!
Still creating...
Still creating...
Still creating...
Done!
Still creating...
Still creating...
Still creating...
Done!
Still creating...
--- PASS: TestAccResourceApp_updateConfig (61.67s)
=== RUN   TestAccResourceApp_scaleDown
Still creating...
Still creating...
Still creating...
Done!
Still creating...
Still creating...
Still creating...
Done!
Still creating...
Still creating...
Done!
--- PASS: TestAccResourceApp_scaleDown (50.85s)
PASS
ok      github.com/aptible/terraform-provider-aptible/aptible   167.627s

I also manually confirmed that the issue has been resolved. I updated the config with the existing provider and it created a deploy and scale (bottom). Then I changed the config twice after installing the updated provider and it only performed the deploy (top).

+------+-------------------------+----------------+---------------------+-----------+----------+----------------------+
|                                             Operation Report: test-app                                              |
+------+-------------------------+----------------+---------------------+-----------+----------+----------------------+
| ID   | Created At              | Type           | Resource            | Status    | Duration | Detail               |
+------+-------------------------+----------------+---------------------+-----------+----------+----------------------+
| 2896 | 2022-10-27 20:40:03 UTC | app::deploy    | test-app            | succeeded | 0:13     | git:                 |
| 2893 | 2022-10-27 20:39:30 UTC | app::deploy    | test-app            | succeeded | 0:13     | git:                 |
| 2889 | 2022-10-27 20:37:51 UTC | service::scale | test-app-cmd-idczrg | succeeded | 0:09     | count: 1, size: 1024 |
| 2888 | 2022-10-27 20:37:36 UTC | app::deploy    | test-app            | succeeded | 0:12     | git:                 |
+------+-------------------------+----------------+---------------------+-----------+----------+----------------------+