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

:sparkles: log drain support #48

Closed neurosnap closed 2 years ago

neurosnap commented 3 years ago

https://aptible.atlassian.net/browse/DP-554

neurosnap commented 3 years ago

So I have the tests working. The only issue is with ImportStateVerify. I can't figure out why it's expecting account_id and database_id since it's not in my tests.

➜  terraform-provider-aptible git:(DP-554-log-drain-support) ✗ make testacc TESTARGS='-run=TestAccResourceLogDrain_elasticsearch'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -count 1 -parallel 20 -run=TestAccResourceLogDrain_elasticsearch -timeout 120m
?       github.com/aptible/terraform-provider-aptible   [no test files]
=== RUN   TestAccResourceLogDrain_elasticsearch
Still creating...
Still creating...
Done!
    resource_log_drain_test.go:18: ImportStateVerify attributes not equivalent. Difference is shown below. Top is actual, bottom is expected.

        (map[string]string) {
        }

        (map[string]string) (len=2) {
         (string) (len=10) "account_id": (string) (len=1) "2",
         (string) (len=11) "database_id": (string) (len=1) "2"
        }
robertfairhead commented 3 years ago

That test verifies that terraform import would work correctly. So after it creates the Log Drain, it wipes it from the terraform state then attempts to import it. It expects the new state to be the same the as the state it had after creating it.

The mismatch there means something is off between how we Set values during creation and now we set values during a read. I don't have time at the moment to dig into the code, but you can start by making sure we Set all the computed fields during a Read

mdelaossa commented 3 years ago

Took a look at the docs and that LGTM by the way 👍

joshraker commented 2 years ago

https://app.shortcut.com/aptible/story/4982/merge-log-drain-terraform-changes

shortcut-integration[bot] commented 2 years ago

This pull request has been linked to Shortcut Story #4982: Merge Log Drain Terraform changes.