Skip to content

Commit 4c73bd7

Browse files
authored
DXE-5628 Merge pull request #98 from akamai/release/v2.5.0
Release/v2.5.0
2 parents 7a2b477 + 0bf2669 commit 4c73bd7

File tree

83 files changed

+11058
-66
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+11058
-66
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
bin/
2-
.idea
2+
.idea
3+
/pkg/providers/**/testdata/res/**/*

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# RELEASE NOTES
22

3+
## 2.5.0 (Oct 15, 2025)
4+
5+
#### FEATURES/ENHANCEMENTS:
6+
7+
* PAPI
8+
* Added support for the new rule format `v2025-09-09`.
9+
10+
* AppSec
11+
* Fixed the `catagoryId` dependency in `modules-security-bot-directory`.
12+
13+
#### BUG FIXES:
14+
15+
* mTLS Truststore (Beta)
16+
* Fixed an issue with the `akamai_mtlstruststore_ca_set` resource where multiline descriptions were incorrectly exported.
17+
318
## 2.4.0 (Sep 4, 2025)
419

520
### FEATURES/ENHANCEMENTS:

cli.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"commands": [
66
{
77
"name": "terraform",
8-
"version": "2.4.0",
8+
"version": "2.5.0",
99
"description": "Export selected resources for faster adoption in Terraform",
1010
"bin": "https://github.com/akamai/cli-terraform/releases/download/v{{.Version}}/akamai-{{.Name}}-{{.Version}}-{{.OS}}{{.Arch}}{{.BinSuffix}}",
1111
"auto-complete": true,

cli/cli.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717

1818
var (
1919
// Version holds current version of cli-terraform
20-
Version = "2.4.0"
20+
Version = "2.5.0"
2121
)
2222

2323
// Run initializes the cli and runs it

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/akamai/cli-terraform/v2
33
go 1.23.6
44

55
require (
6-
github.com/akamai/AkamaiOPEN-edgegrid-golang/v12 v12.0.0
6+
github.com/akamai/AkamaiOPEN-edgegrid-golang/v12 v12.1.0
77
github.com/akamai/cli/v2 v2.0.2
88
github.com/fatih/color v1.18.0
99
github.com/hashicorp/hcl/v2 v2.23.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2 h1:+vx7roKuyA63n
66
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2/go.mod h1:HBCaDeC1lPdgDeDbhX8XFpy1jqjK0IBG8W5K+xYqA0w=
77
github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo=
88
github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
9-
github.com/akamai/AkamaiOPEN-edgegrid-golang/v12 v12.0.0 h1:UED1jCu37aILAC6MuXE+K7j4EL3F0dT9wgcqASJlOos=
10-
github.com/akamai/AkamaiOPEN-edgegrid-golang/v12 v12.0.0/go.mod h1:Bf6hnZkloZnfL4I/gFGnMMMdMHiu/ERnSOWtFgnodDk=
9+
github.com/akamai/AkamaiOPEN-edgegrid-golang/v12 v12.1.0 h1:feVgyeLunm1eepTK9urvVpyhXCgEuSnfUxyYfMCtD0g=
10+
github.com/akamai/AkamaiOPEN-edgegrid-golang/v12 v12.1.0/go.mod h1:Bf6hnZkloZnfL4I/gFGnMMMdMHiu/ERnSOWtFgnodDk=
1111
github.com/akamai/cli/v2 v2.0.2 h1:gqjVTqN5lp3t5RjVVl+q7u+aW8YOZ4/kIYG0bg6Xhy8=
1212
github.com/akamai/cli/v2 v2.0.2/go.mod h1:5tLoIp57aX21plVEcI0TeYz6C54ek6zlPnIHhfe1YRk=
1313
github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY=

pkg/providers/appsec/create_appsec.go

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,14 @@ func CmdCreateAppsec(c *cli.Context) error {
138138
"getWAFMode": getWAFMode,
139139
"isStructuredRule": isStructuredRule,
140140
"exportJSONWithoutKeys": exportJSONWithoutKeys,
141+
"exportJSONForCustomDefBotsWithoutKeys": exportJSONForCustomDefBotsWithoutKeys,
141142
"getCustomBotCategoryResourceNamesByIDs": getCustomBotCategoryResourceNamesByIDs,
142143
"getCustomBotCategoryNameByID": getCustomBotCategoryNameByID,
143144
"getCustomClientResourceNamesByIDs": getCustomClientResourceNamesByIDs,
144145
"getContentProtectionRuleResourceNamesByIDs": getContentProtectionRuleResourceNamesByIDs,
145146
"getProtectedHostsByID": getProtectedHostsByID,
146147
"getEvaluatedHostsByID": getEvaluatedHostsByID,
148+
"buildCategoryMap": buildCategoryMap,
147149
})
148150

149151
// The template processor
@@ -533,6 +535,55 @@ func exportJSONWithoutKeys(source map[string]interface{}, keys ...string) (strin
533535
return string(js), nil
534536
}
535537

538+
// exportJSONForCustomDefBotsWithoutKeys returns json string without specified keys and categoryId pointing to category resource category_id
539+
func exportJSONForCustomDefBotsWithoutKeys(source map[string]interface{}, categoryData map[string]string, keys ...string) (string, error) {
540+
// deep copy source by converting to json
541+
js, err := json.Marshal(source)
542+
if err != nil {
543+
return "", err
544+
}
545+
dest := make(map[string]interface{})
546+
err = json.Unmarshal(js, &dest)
547+
if err != nil {
548+
return "", err
549+
}
550+
for _, key := range keys {
551+
delete(dest, key)
552+
}
553+
554+
// Change the value of the categoryId key
555+
if _, exists := dest["categoryId"]; exists {
556+
categoryName, _ := tools.EscapeName(categoryData[dest["categoryId"].(string)])
557+
dest["categoryId"] = "${akamai_botman_custom_bot_category" + "." + categoryName + "_" + dest["categoryId"].(string) + "." + "category_id}"
558+
}
559+
560+
js, err = json.MarshalIndent(dest, "", " ")
561+
if err != nil {
562+
return "", err
563+
}
564+
565+
return string(js), nil
566+
}
567+
568+
func buildCategoryMap(source []map[string]interface{}) (map[string]string, error) {
569+
categoryMap := make(map[string]string)
570+
571+
for _, category := range source {
572+
categoryID, ok := category["categoryId"].(string)
573+
if !ok {
574+
return nil, errors.New("missing or invalid categoryId")
575+
}
576+
577+
categoryName, ok := category["categoryName"].(string)
578+
if !ok {
579+
return nil, errors.New("missing or invalid categoryName")
580+
}
581+
582+
categoryMap[categoryID] = categoryName
583+
}
584+
585+
return categoryMap, nil
586+
}
536587
func getCustomBotCategoryNameByID(customBotCategories []map[string]interface{}, categoryID string) (string, error) {
537588
for _, category := range customBotCategories {
538589
if category["categoryId"].(string) == categoryID {

pkg/providers/appsec/create_appsec_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,8 @@ func TestProcessPolicyTemplates(t *testing.T) {
306306
"getContentProtectionRuleResourceNamesByIDs": getContentProtectionRuleResourceNamesByIDs,
307307
"getProtectedHostsByID": getProtectedHostsByID,
308308
"getEvaluatedHostsByID": getEvaluatedHostsByID,
309+
"exportJSONForCustomDefBotsWithoutKeys": exportJSONForCustomDefBotsWithoutKeys,
310+
"buildCategoryMap": buildCategoryMap,
309311
})
310312

311313
// Template to path mappings
@@ -424,12 +426,14 @@ func TestProcessPolicyTemplatesWithBotman(t *testing.T) {
424426
"isStructuredRule": isStructuredRule,
425427
"exportJSON": exportJSON,
426428
"exportJSONWithoutKeys": exportJSONWithoutKeys,
429+
"exportJSONForCustomDefBotsWithoutKeys": exportJSONForCustomDefBotsWithoutKeys,
427430
"getCustomBotCategoryNameByID": getCustomBotCategoryNameByID,
428431
"getCustomBotCategoryResourceNamesByIDs": getCustomBotCategoryResourceNamesByIDs,
429432
"getCustomClientResourceNamesByIDs": getCustomClientResourceNamesByIDs,
430433
"getContentProtectionRuleResourceNamesByIDs": getContentProtectionRuleResourceNamesByIDs,
431434
"getProtectedHostsByID": getProtectedHostsByID,
432435
"getEvaluatedHostsByID": getEvaluatedHostsByID,
436+
"buildCategoryMap": buildCategoryMap,
433437
})
434438

435439
// Template to path mappings

pkg/providers/appsec/templates/modules-security-bot-directory.tmpl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,15 @@ resource "akamai_botman_custom_bot_category_sequence" "custom_bot_category_seque
2828
}
2929

3030
{{ end -}}
31+
32+
{{ $categoryMap := buildCategoryMap .CustomBotCategories -}}
33+
3134
{{ if .CustomDefinedBots -}}
3235
{{ range .CustomDefinedBots -}}
3336
resource "akamai_botman_custom_defined_bot" "{{escapeName (index . "botName")}}_{{(index . "botId")}}" {
3437
config_id = akamai_botman_custom_bot_category_sequence.custom_bot_category_sequence.config_id
3538
custom_defined_bot = jsonencode(
36-
{{ exportJSONWithoutKeys . "botId" }}
39+
{{ exportJSONForCustomDefBotsWithoutKeys . $categoryMap "botId" }}
3740
)
3841
}
3942

pkg/providers/appsec/testdata/ase-botman.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3919,6 +3919,7 @@
39193919
{
39203920
"botId": "50789280-ba99-4f8f-b4c6-ad9c1c69569a",
39213921
"botName": "Bot A",
3922+
"categoryId": "dae597b8-b552-4c95-ab8b-066a3fef2f75",
39223923
"primitiveKey": "primitiveValueA",
39233924
"arrayKey": [
39243925
"arrayValueA1",

0 commit comments

Comments
 (0)