https://pulumi.com logo
#aws
Title
# aws
h

helpful-account-44059

07/27/2022, 6:31 AM
Hi, I have aws sns topic access policy as picture, it was edited by manual, when i try to translate to pulumi IaC code, it not accepted 1. Statement IDs (SID) must be alpha-numeric.
Copy code
Check that your input satisfies the regular expression [0-9A-Za-z]*
2. I change the Sid to AllowPublishAlarms
Copy code
error creating IAM Policy sns-access-policy: MalformedPolicyDocument: Policy document should not specify a principal
Copy code
const snsAccessPolicy = new aws.iam.Policy("sns-access-policy", {
  name: "sns-access-policy",
  policy: {
    Version: "2012-10-17",
    Statement: [
      {
        Sid: "Allow_Publish_Alarms",
        Effect: "Allow",
        Principal: {
          Service: "<http://aps.amazonaws.com|aps.amazonaws.com>",
        },
        Action: ["sns:Publish", "sns:GetTopicAttributes"],
        Resource: "arn:aws:sns:ap-southeast-1:482414749843:amp-sns-topic",
        Condition: {
          StringEquals: {
            "AWS:SourceAccount": "482414749843",
          },
          ArnEquals: {
            "aws:SourceArn":
              "arn:aws:aps:ap-southeast-1:482414749843:workspace/ws-be6e741f-d8ac-4330-b0fb-6a0c0aa92d6f",
          },
        },
      },
    ],
  },
});
Am I asking a stupid question?
2 Views