Hey folks,
I’m trying to implement a custom Terraform provider for Bitwarden and following the tutorial with the Terraform Plugin Framework.
Manually I’ve verified my implementation is working as expected. But when implementing the acceptance tests, I need some help.
The last_updated field during a Read & Update
TestStep is failing with the following message:
error=
| exit status 1
| There are some problems with the CLI configuration:
| ╷
| │ Error: Invalid provider installation dev overrides
| │
| │ The entry "onesignal/terraform-provider-bitwarden" in 1:1 is not a valid
| │ provider source string.
| ╵
|
| As a result of the above problems, Terraform may not behave as intended.
|
|
|
| Error: Provider produced inconsistent result after apply
|
| When applying changes to bitwarden_group.test, provider
| "provider[\"registry.terraform.io/hashicorp/bitwarden\"]" produced an
| unexpected new value: .last_updated: was cty.StringVal("Friday, 04-Aug-23
| 16:23:02 CEST"), but now cty.StringVal("Friday, 04-Aug-23 16:23:07 CEST").
|
| This is a bug in the provider, which should be reported in the provider's own
| issue tracker.
The last_updated field is set during the initial creation and later updated during the update step with a new value. I expect it to change.
Currently, my test case looks as follows:
func TestAccGroupResource(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
Steps: []resource.TestStep{
// Create and Read testing
{
Config: testAccGroupResourceConfig("one", "", true),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("bitwarden_group.test", "name", "one"),
resource.TestCheckResourceAttr("bitwarden_group.test", "access_all", "true"),
resource.TestCheckResourceAttrSet("bitwarden_group.test", "id"),
resource.TestCheckResourceAttrSet("bitwarden_group.test", "last_updated"),
),
},
// ImportState testing
{
ResourceName: "bitwarden_group.test",
ImportState: true,
ImportStateVerify: true,
// This is not normally necessary, but is here because this
// example code does not have an actual upstream service.
// Once the Read method is able to refresh information from
// the upstream service, this can be removed.
ImportStateVerifyIgnore: []string{"last_updated"},
},
//Update and Read testing
{
Config: testAccGroupResourceConfig("two", "external-two", false),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("bitwarden_group.test", "name", "two"),
resource.TestCheckResourceAttr("bitwarden_group.test", "external_id", "external-two"),
resource.TestCheckResourceAttr("bitwarden_group.test", "access_all", "false"),
),
},
// Delete testing automatically occurs in TestCase
},
})
}
When I verify with the tutorial repository is following the same pattern, also updating the last_updated timestamp during the update action, but I assume it’s not failing the tests.
If there’s anyone who could point me in the right direction, I’d appreciate it