Closed neurosnap closed 2 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"
}
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
Took a look at the docs and that LGTM by the way 👍
This pull request has been linked to Shortcut Story #4982: Merge Log Drain Terraform changes.
https://aptible.atlassian.net/browse/DP-554