-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to actually use the aws_sqs_queue's "policy" attribute? #3549
Comments
Hey @eoliphan – can you help me understand what you're looking for here? SQS does have a |
Hi, here's an example. I want 'my queue' to accept bucket notifications from 'my bucket'. AFAIK, the 'Resource' key has to be defined when I'm adding this policy to 'my queue'. Since it's an ARN, it needs to 'my queue' needs to have already been created in order for this to work. And as I mentioned, I get errors to that effect. TF doesn't like it, when I set the Resource based on the ARN variable as I'm referring to 'myself' at that point, inside the resource block for 'my queue'
|
+1 |
Can we move the policy to it's own TF resource |
Is it actually necessary to include the explicit In the underlying API the policy is a part of the attribute set provided to |
@apparentlymart it seems so. I couldn't find documentation on it, but I ran a little functional test. Without the |
+1 |
I wonder then if Terraform has enough information to synthesize the Is there any use-case for the policy on a given queue having a |
+1 Just ran into this. Looking for workaround. |
+1 |
1 similar comment
+1 |
it finally works for me, here is my template for the sqs queue:
|
+1 |
I think this issue may be resolved by #8657 released in v0.7.3 |
Correct @conorgil Do let us know if you have any issues with this new resource. |
I have a similar sort of issue with some thing different, Now I don't want to write the policy in the terraform instead i created a custom policy in aws using console and and assigned to a user whose credentials i am using to execute my terraform script, but i have problem here. I have to set a condition into the policy so that i can dynamically pass the topic arn to the policy defined in aws. Is there any way to use already existing policy at aws in terraform, or atleast modify it or add some more things to it like condition etc using terraform. My Code goes like this. I am not finding any this sort of example. can any one help is it possible or not, is there any way to avoid policy writing in tf script. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
I'm trying to use this and I keep getting an InvalidAttributeValue from the AWS api. I think the problem is that, the policy requires a "Resource" identifier with the queue's ARN and we can't do that within Terraform directly as it creates dependency on itself. So I tried removing the Resource identifier to see if perhaps Terraform would magically add it. No joy there either. I think the ultimate solution for this would be to 1) implement said magic, that might not be the cleanest approach, 2) make something like a separate 'aws_sqs_policy' resource such that the references could work and the policy would be applied after the queue actually exists, 3) have terraform do some sort of deferred resolution when it sees a nested reference.
I guess 2 is probably the most inline with the way TF works now. TF would need something similar for say future support of s3 bucket notifications, they don't even work properly in CloudFormation as they're defined on the s3 resource, but CF doesn't wait for the bucket to actually exist prior to applying the notification. For now I'm just wrapping TF in a ruby script, that runs TF, then reads the state file and applies the policy,etc
The text was updated successfully, but these errors were encountered: