1
1
package provider
2
2
3
3
import (
4
- "github.com/hashicorp/terraform-plugin-go/tfprotov6"
5
- "github.com/hashicorp/terraform-plugin-testing/echoprovider"
4
+ "os"
6
5
"testing"
7
6
7
+ "github.com/hashicorp/terraform-plugin-go/tfprotov6"
8
+ "github.com/hashicorp/terraform-plugin-testing/echoprovider"
8
9
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
9
10
)
10
11
11
12
func TestAccTFEHYOKCustomerKeyVersionDataSource_basic (t * testing.T ) {
13
+ hyokCustomerKeyVersionId := os .Getenv ("HYOK_CUSTOMER_KEY_VERSION_ID" )
14
+ if hyokCustomerKeyVersionId == "" {
15
+ t .Skip ("HYOK_CUSTOMER_KEY_VERSION_ID environment variable must be set to run this test" )
16
+ }
17
+
12
18
resource .Test (t , resource.TestCase {
13
19
PreCheck : func () { testAccPreCheck (t ) },
14
20
ProtoV5ProviderFactories : testAccMuxedProviders ,
@@ -17,11 +23,11 @@ func TestAccTFEHYOKCustomerKeyVersionDataSource_basic(t *testing.T) {
17
23
},
18
24
Steps : []resource.TestStep {
19
25
{
20
- Config : testAccTFEHYOKCustomerKeyVersionDataSourceConfig ,
26
+ Config : testAccTFEHYOKCustomerKeyVersionDataSourceConfig ( hyokCustomerKeyVersionId ) ,
21
27
Check : resource .ComposeAggregateTestCheckFunc (
22
- resource .TestCheckResourceAttr ("data.tfe_hyok_customer_key_version.test" , "id" , "keyv-BWZTzt2J75DsdwH8" ),
23
- resource .TestCheckResourceAttr ("data.tfe_hyok_customer_key_version.test" , "status" , "available " ),
24
- resource .TestCheckResourceAttr ("data.tfe_hyok_customer_key_version.test" , "key_version" , "10 " ),
28
+ resource .TestCheckResourceAttr ("data.tfe_hyok_customer_key_version.test" , "id" , hyokCustomerKeyVersionId ),
29
+ resource .TestCheckResourceAttrSet ("data.tfe_hyok_customer_key_version.test" , "status" ),
30
+ resource .TestCheckResourceAttrSet ("data.tfe_hyok_customer_key_version.test" , "key_version" ),
25
31
resource .TestCheckResourceAttrSet ("data.tfe_hyok_customer_key_version.test" , "created_at" ),
26
32
resource .TestCheckResourceAttrSet ("data.tfe_hyok_customer_key_version.test" , "updated_at" ),
27
33
),
@@ -30,12 +36,10 @@ func TestAccTFEHYOKCustomerKeyVersionDataSource_basic(t *testing.T) {
30
36
})
31
37
}
32
38
33
- const testAccTFEHYOKCustomerKeyVersionDataSourceConfig = `
34
- data "tfe_organization" "org" {
35
- name = "dretli-hyok-org"
36
- }
37
-
39
+ func testAccTFEHYOKCustomerKeyVersionDataSourceConfig (id string ) string {
40
+ return `
38
41
data "tfe_hyok_customer_key_version" "test" {
39
- id = "keyv-BWZTzt2J75DsdwH8 "
42
+ id = "` + id + ` "
40
43
}
41
44
`
45
+ }
0 commit comments