OpenTofu v1.8.7
v5.81.0
The platform_principal needs to be the contents of a p12 file for APNS. Since that is a binary file and terraform expects all strings to be utf-8 (see e.g. https://developer.hashicorp.com/terraform/language/functions/base64decode), we have a bit of a problem.
I guess one option would be to add a mutually exclusive platform_principal_base64 that would eat bas64 encoded data instead.
resource "aws_sns_platform_application" "apns_application" {
name = "APNS-01"
platform = "APNS"
platform_credential = data.onepassword_item.sns_apns_cert_key.password
platform_principal = base64decode(data.onepassword_item.sns_apns_cert.file[0].content_base64)
}
Should apply correctly.
│ Call to function "base64decode" failed: the result of decoding the provided string is not valid UTF-8.
No response
resource "aws_sns_platform_application" "apns_application" {
name = "APNS-01"
platform = "APNS"
platform_credential = data.onepassword_item.sns_apns_cert_key.password
platform_principal = base64decode(data.onepassword_item.sns_apns_cert.file[0].content_base64)
}
tofu apply
No response
No response
No response
No response
I might be able to implement the suggested fix