Skip to content

Commit 2ab8e22

Browse files
wip
1 parent 698e20c commit 2ab8e22

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

codefresh/context/storage.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func flattenStorageContextConfig(spec cfclient.ContextSpec, auth map[string]inte
5454
func FlattenJsonConfigStorageContextConfig(spec cfclient.ContextSpec) []interface{} {
5555
auth := make(map[string]interface{})
5656
auth["json_config"] = spec.Data["auth"].(map[string]interface{})["jsonConfig"]
57-
auth["type"] = spec.Data["type"]
57+
auth["type"] = spec.Data["auth"].(map[string]interface{})["type"]
5858
return flattenStorageContextConfig(spec, auth)
5959
}
6060

codefresh/resource_context.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ var supportedContextType = []string{
3131
var encryptedContextTypes = []string{
3232
contextSecret,
3333
contextSecretYaml,
34+
contextS3Storage,
35+
contextAzureStorage,
3436
}
3537

3638
func getConflictingContexts(context string) []string {

codefresh/resource_context_test.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func TestAccCodefreshContextSecretYaml(t *testing.T) {
129129
CheckDestroy: testAccCheckCodefreshContextDestroy,
130130
Steps: []resource.TestStep{
131131
{
132-
Config: testAccCodefreshContextSecretYaml(name, "rootKey", "plainKey", "plainValue", "listKey", "listValue1", "listValue2"),
132+
Config: testAccCodefreshContextSecretYaml(name, "rootKey", "plainKey", "plainValue", "listKey", "listValue1", "listValue2", true),
133133
Check: resource.ComposeTestCheckFunc(
134134
testAccCheckCodefreshContextExists(resourceName),
135135
resource.TestCheckResourceAttr(resourceName, "name", name),
@@ -159,7 +159,7 @@ func testAccCheckCodefreshContextExists(resource string) resource.TestCheckFunc
159159
contextID := rs.Primary.ID
160160

161161
apiClient := testAccProvider.Meta().(*cfclient.Client)
162-
_, err := apiClient.GetContext(contextID, true)
162+
_, err := apiClient.GetContext(contextID, false)
163163

164164
if err != nil {
165165
return fmt.Errorf("error fetching context with ID %s. %s", contextID, err)
@@ -177,7 +177,7 @@ func testAccCheckCodefreshContextDestroy(s *terraform.State) error {
177177
continue
178178
}
179179

180-
_, err := apiClient.GetContext(rs.Primary.ID, true)
180+
_, err := apiClient.GetContext(rs.Primary.ID, false)
181181

182182
if err == nil {
183183
return fmt.Errorf("Alert still exists")
@@ -249,18 +249,20 @@ resource "codefresh_context" "test" {
249249
`, rName, rootKey, plainKey, plainValue, listKey, listValue1, listValue2)
250250
}
251251

252-
func testAccCodefreshContextSecretYaml(rName, rootKey, plainKey, plainValue, listKey, listValue1, listValue2 string) string {
252+
func testAccCodefreshContextSecretYaml(rName, rootKey, plainKey, plainValue, listKey, listValue1, listValue2 string, decryptSpec bool) string {
253253

254254
return fmt.Sprintf(`
255255
resource "codefresh_context" "test" {
256256
257257
name = "%s"
258258
259+
decrypt_spec = %v
260+
259261
spec {
260262
secretyaml {
261263
data = "%s: \n %s: %s\n %s: \n - %s\n - %s"
262264
}
263265
}
264266
}
265-
`, rName, rootKey, plainKey, plainValue, listKey, listValue1, listValue2)
267+
`, rName, decryptSpec, rootKey, plainKey, plainValue, listKey, listValue1, listValue2)
266268
}

0 commit comments

Comments
 (0)