hashicorp/terraform-provider-aws

[Documentation]: Add example for specifying p12 certificate with `aws_sns_platform_application`

Aperta

#40.803 aperta il 7 gen 2025

 (5 commenti) (0 reazioni) (0 assegnatari)Go (10.312 fork)github user discovery
documentationgood first issueservice/sns

Metriche repository

Star
 (11.045 stelle)
Metriche merge PR
 (Merge medio 19g 21h) (251 PR mergiate in 30 g)

Descrizione

Terraform Core Version

OpenTofu v1.8.7

AWS Provider Version

v5.81.0

Affected Resource(s)

  • aws_sns_platform_application APNS

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.

Expected Behavior

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.

Actual Behavior

│ Call to function "base64decode" failed: the result of decoding the provided string is not valid UTF-8.

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

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)
}

Steps to Reproduce

tofu apply

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

I might be able to implement the suggested fix

Guida contributor