https://pulumi.com logo
Title
e

elegant-dog-76355

02/27/2023, 5:48 PM
I am also trying to create a sqs policy by using the output of a resource but getting the following error. If I do the following the policy works fine:
"Principal": {{
"Service": "<http://s3.amazonaws.com|s3.amazonaws.com>"
}},
"Action": "sqs:SendMessage",
"Resource": "arn:aws:sqs:{get_aws_region_name()}:{get_aws_account_no()}:queue-3ca39a5"
}}
but if I try to use the arn output of a resource like so:
"Resource": "{queue.arn}"
I get the error: error:
aws:sqs/queuePolicy:QueuePolicy resource 'test' has a problem: "policy" contains an invalid JSON: invalid character '\n' in string literal. Examine values at 'QueuePolicy.Policy'.
This happens even if i cast the
queue.arn
into a
string
variable and use the
strip
function to remove any
\n
. IF there a way to pass the output or a resource (like the
arn
) into a policy without getting this error ?
e

echoing-dinner-19531

02/27/2023, 5:48 PM
You can't cast resource outputs to plain strings. See the docs at https://www.pulumi.com/docs/intro/concepts/inputs-outputs/#outputs-and-strings
e

elegant-dog-76355

02/28/2023, 9:22 AM
thanks ... finally got my head around it I think