akamai / cli-terraform

Akamai CLI plugin Admin Support for multiple OpenAPI resource types
Apache License 2.0
21 stars 11 forks source link

DXE-3248 Error exporting Property Config when config contains Custom Certificate Authority Set #65

Closed zDavidB closed 7 months ago

zDavidB commented 7 months ago

Issue

When trying to setup a terraform config for using the akamai terraform export-property tool, an error exporting a PM config with --schema option, on the last step, Saving TF configurations fails with an error

Error exporting property: saving terraform project files: executing template: rules_v2023-09-20.tmpl: template: multiline.tmpl:3:15: executing "Text" at <IsMultiline>: wrong type for value; expected string; got float64

the error appears on v2023-01-05 rule formats as well.

I think I've found the solution though. In the config I want to export, there are a number of Origin server behaviours with Custom Certificate Authority Set certificates imported (Amazon and Starfield certs), resulting in json rules like this...

"notBefore": 1445472000000,
"notAfter": 1760832000000,
"sigAlgName": "SHA256withRSA",
"publicKey": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwk4WZ93OvGrIN1rsOjCwHebREugSKEjM6CnBuW5T1aPrAzkazHeH9gG52XDMz2uN4+MDcYaZbcumlCpOE9anvQTsChY8Cus5scS1WKO2x1Yl7D5SeqjjKRYHuW5Qz/tfMfgdugNKYokDrj5H8g8nkeMUIIX4+umKNfVfnplN52s376RQPkTs+lqFZgecfhdqVfMXijUe7umsw3VOWFV9U2sKa5sUQtflrAGJs+qj/s/AKwyEwthTFctn8NCIyjrRF3P1X5rUxXIefgHxmDBjKqryei3F4gIahuUyPg69EbTPPJPvF1AQnkPCBirgDWi+04iLSmWMStTDLkybVfSG5QIDAQAB",
"publicKeyAlgorithm": "RSA",
"publicKeyFormat": "X.509",
"serialNumber": 1.4491820963098927e+44,
"version": 3,
"sha1Fingerprint": "917e732d330f9a12404f73d8bea36948b929dffc",
"pemEncodedCert": "-----BEGIN CERTIFICATE-----\nMIIESTCCAzGgAwIBAgITBn+UV4WH6Kx33rJTMlu8mYtWDTANBgkqhkiG9w0BAQsF\nADA5MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFw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Gt/a6ZiqyJEi+752+a1U5y6iAwYfmXss2lJwJFqMp2PphKg5625kXg8kP2CN5t\n6G7bMQcT8C8xDZNtYTd7WPD8UZiRKAJPBXa30/AbwuZe0GaFEQ8ugcYQgSn+IGBI\n8/LwhBNTZTUVEWuCUUBVV18YtbAiPq3yXqMB48Oz+ctBWuZSkbvkNodPLamkB2g1\nupRyzQ7qDn1X8nn8N8V7YJ6y68AtkHcNSRAnpTitxBKjtKPISLMVCx7i4hncxHZS\nyLyKQXhw2W2Xs0qLeC1etA+jTGDK4UfLeC0SF7FSi8o5LL21L8IzApar2pR/\n-----END CERTIFICATE-----\n",
"canBeLeaf": false,
"canBeCA": true,
"selfSigned": false

The serialNumber field is the only place in the rule tree I can see that contains a value that appears to be a "float" datatype (as referred to in the initial error).

Having gone through the PM config in the ACC console I removed the custom certs from each Origin server behaviour and saved the config, rerunning the terrform export-property command, it now completes successfully.

Expected behaviour

The terraform export-property command should complete with the custom certs inplace in the origin server behaviour.

lkowalsk-akamai-com commented 7 months ago

This issue should be fixed now with 1.11.0 cli-terraform version.