2020 }
2121
2222 keyDataSourceRepresentation = map [string ]interface {}{
23- "compartment_id" : Representation {repType : Required , create : `${var.compartment_id }` },
23+ "compartment_id" : Representation {repType : Required , create : `${var.tenancy_ocid }` },
2424 "management_endpoint" : Representation {repType : Required , create : `${data.oci_kms_vault.test_vault.management_endpoint}` },
2525 "filter" : RepresentationGroup {Required , keyDataSourceFilterRepresentation }}
2626 keyDataSourceFilterRepresentation = map [string ]interface {}{
2929 }
3030
3131 keyRepresentation = map [string ]interface {}{
32- "compartment_id" : Representation {repType : Required , create : `${var.compartment_id }` },
32+ "compartment_id" : Representation {repType : Required , create : `${var.tenancy_ocid }` },
3333 "display_name" : Representation {repType : Required , create : `Key C` , update : `displayName2` },
3434 "key_shape" : RepresentationGroup {Required , keyKeyShapeRepresentation },
3535 "management_endpoint" : Representation {repType : Required , create : `${data.oci_kms_vault.test_vault.management_endpoint}` },
@@ -72,6 +72,7 @@ func TestKmsKeyResource_basic(t *testing.T) {
7272
7373 compartmentId := getEnvSettingWithBlankDefault ("compartment_ocid" )
7474 compartmentIdVariableStr := fmt .Sprintf ("variable \" compartment_id\" { default = \" %s\" }\n " , compartmentId )
75+ tenancyId := getEnvSettingWithBlankDefault ("tenancy_ocid" )
7576
7677 resourceName := "oci_kms_key.test_key"
7778 datasourceName := "data.oci_kms_keys.test_keys"
@@ -90,7 +91,7 @@ func TestKmsKeyResource_basic(t *testing.T) {
9091 Config : config + compartmentIdVariableStr + KeyResourceDependencies +
9192 generateResourceFromRepresentationMap ("oci_kms_key" , "test_key" , Required , Create , keyRepresentation ),
9293 Check : resource .ComposeAggregateTestCheckFunc (
93- resource .TestCheckResourceAttr (resourceName , "compartment_id" , compartmentId ),
94+ resource .TestCheckResourceAttr (resourceName , "compartment_id" , tenancyId ),
9495 resource .TestCheckResourceAttr (resourceName , "display_name" , "Key C" ),
9596 resource .TestCheckResourceAttr (resourceName , "key_shape.#" , "1" ),
9697 resource .TestCheckResourceAttr (resourceName , "key_shape.0.algorithm" , "AES" ),
@@ -108,7 +109,7 @@ func TestKmsKeyResource_basic(t *testing.T) {
108109 Config : config + compartmentIdVariableStr + KeyResourceDependencies +
109110 generateResourceFromRepresentationMap ("oci_kms_key" , "test_key" , Optional , Update , keyRepresentation ),
110111 Check : resource .ComposeAggregateTestCheckFunc (
111- resource .TestCheckResourceAttr (resourceName , "compartment_id" , compartmentId ),
112+ resource .TestCheckResourceAttr (resourceName , "compartment_id" , tenancyId ),
112113 resource .TestCheckResourceAttrSet (resourceName , "current_key_version" ),
113114 resource .TestCheckResourceAttr (resourceName , "display_name" , "displayName2" ),
114115 resource .TestCheckResourceAttrSet (resourceName , "id" ),
@@ -135,10 +136,10 @@ func TestKmsKeyResource_basic(t *testing.T) {
135136 compartmentIdVariableStr + KeyResourceDependencies +
136137 generateResourceFromRepresentationMap ("oci_kms_key" , "test_key" , Optional , Update , keyRepresentation ),
137138 Check : resource .ComposeAggregateTestCheckFunc (
138- resource .TestCheckResourceAttr (datasourceName , "compartment_id" , compartmentId ),
139+ resource .TestCheckResourceAttr (datasourceName , "compartment_id" , tenancyId ),
139140
140141 resource .TestCheckResourceAttr (datasourceName , "keys.#" , "1" ),
141- resource .TestCheckResourceAttr (datasourceName , "keys.0.compartment_id" , compartmentId ),
142+ resource .TestCheckResourceAttr (datasourceName , "keys.0.compartment_id" , tenancyId ),
142143 resource .TestCheckResourceAttr (datasourceName , "keys.0.display_name" , "displayName2" ),
143144 resource .TestCheckResourceAttrSet (datasourceName , "keys.0.id" ),
144145 resource .TestCheckResourceAttrSet (datasourceName , "keys.0.state" ),
@@ -154,7 +155,7 @@ func TestKmsKeyResource_basic(t *testing.T) {
154155 Check : resource .ComposeAggregateTestCheckFunc (
155156 resource .TestCheckResourceAttrSet (singularDatasourceName , "key_id" ),
156157
157- resource .TestCheckResourceAttr (singularDatasourceName , "compartment_id" , compartmentId ),
158+ resource .TestCheckResourceAttr (singularDatasourceName , "compartment_id" , tenancyId ),
158159 resource .TestCheckResourceAttrSet (singularDatasourceName , "current_key_version" ),
159160 resource .TestCheckResourceAttr (singularDatasourceName , "display_name" , "displayName2" ),
160161 resource .TestCheckResourceAttrSet (singularDatasourceName , "id" ),
0 commit comments