Open Codelax opened 1 year ago
Hello,
I had the same problem today. I have multiple passwords.
If i check my password 3 passwords are encoded in base64 and 3 not.
It seems that if the password have no special char in this case "scaleway_secret_version" send the password without base64 encoding.
output "password_test" {
value = [ for password in [
local.secret_fields_information["password1"].data,
local.secret_fields_information["password2"].data,
local.secret_fields_information["password3"].data,
local.secret_fields_information["password4"].data,
local.secret_fields_information["password5"].data,
local.secret_fields_information["password6"].data
] : password]
}
Output:
+ password_test = [
+ "BASE64ENCODED", # Special char inside password
+ "NOBASE64ENCODED", # No special char inside password
+ "NOBASE64ENCODED", # No special char inside password
+ "NOBASE64ENCODED", # No special char inside password
+ "BASE64ENCODED", # Special char inside password
+ "BASE64ENCODED", # Special char inside password
]
For Terraform error "the result of decoding the provided string is not valid UTF-8.":
╷
│ Error: Error in function call
│ Call to function "base64decode" failed: the result of decoding the provided string is not valid UTF-8.
This error is present because Terraform wants to have base64 encoded text but the text is on clear. It's just a side effect of scaleway_secret_version problem. If the resource "scaleway_secret_version" is fixed your error will disappear.
The solution i think is to convert in base64 all passwords even if no special char is present to avoid different behaviors.
Regards,
This present an idea to improve secret api by adding new fields.
The first one would be adding a base64 field to allow uploading files or anything that is not valid utf-8
For the datasource, we could add a
type
field that default tobase64
.