Skip to content

Commit 8052387

Browse files
terraform storage integration
1 parent e62dd8b commit 8052387

File tree

2 files changed

+40
-7
lines changed

2 files changed

+40
-7
lines changed

codefresh/context/storage.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ func ConvertAzureStorageContext(context []interface{}) map[string]interface{} {
2525
contextAuth := contextData["auth"].([]interface{})[0].(map[string]interface{})
2626
auth := make(map[string]interface{})
2727
auth["type"] = contextAuth["type"]
28-
auth["account_name"] = contextAuth["account_name"]
29-
auth["account_key"] = contextAuth["account_key"]
28+
auth["accountName"] = contextAuth["account_name"]
29+
auth["accountKey"] = contextAuth["account_key"]
3030
return convertStorageContext(context, auth)
3131
}
3232

@@ -61,8 +61,8 @@ func FlattenJsonConfigStorageContextConfig(spec cfClient.ContextSpec) []interfac
6161
func FlattenAzureStorageContextConfig(spec cfClient.ContextSpec) []interface{} {
6262
auth := make(map[string]interface{})
6363
authParams := spec.Data["auth"].(map[string]interface{})
64-
auth["account_name"] = authParams["account_name"]
65-
auth["account_key"] = authParams["account_key"]
64+
auth["account_name"] = authParams["accountName"]
65+
auth["account_key"] = authParams["accountKey"]
6666
auth["type"] = spec.Data["type"]
6767
return flattenStorageContextConfig(spec, auth)
6868
}

examples/storate_integration/main.tf

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,49 @@
1-
resource "codefresh_context" "storage_integration" {
1+
resource "codefresh_context" "gcs" {
22
for_each = toset(["create"])
3-
name = "pasha-test-t2"
3+
name = "gcs"
44
spec {
55
storagegc {
66
data {
77
auth {
88
type = "basic"
99
json_config = tomap({
10-
"fd": "fd"
10+
"config": "cf"
1111
})
1212
}
1313
}
1414
}
1515
}
1616
}
17+
18+
resource "codefresh_context" "s3" {
19+
for_each = toset(["create"])
20+
name = "s3"
21+
spec {
22+
storages3 {
23+
data {
24+
auth {
25+
type = "basic"
26+
json_config = tomap({
27+
"config": "cf"
28+
})
29+
}
30+
}
31+
}
32+
}
33+
}
34+
35+
resource "codefresh_context" "azure" {
36+
for_each = toset(["create"])
37+
name = "azure"
38+
spec {
39+
storageazuref {
40+
data {
41+
auth {
42+
type = "basic"
43+
account_name = "accName"
44+
account_key = "accKey"
45+
}
46+
}
47+
}
48+
}
49+
}

0 commit comments

Comments
 (0)