accounts: - account_id: '123123123123' name: account-1 role: arn:aws:iam::123123123123:role/CloudCustodian vars: admin-email: 'account...@email.com'
- account_id: '321321321321' name: account-2 role: arn:aws:iam::321321321321:role/CloudCustodian vars: admin-email: 'account...@email.com'
Then I use them in policies like this:
actions: - type: notify template: default.html priority_header: 1 subject: "My Subject - [custodian {{ account }} - {{ region }}]" violation_desc: "RDS Instance has had no connections in the last 28 days and has been deleted." action_desc: "Description" to: - { admin-email } - event-owner transport: type: sqs queue: https://sqs.us-east-1.amazonaws.com/123123123123/cloud-custodian-mailer region: us-east-1
When I use the { admin-email } variable, c7n Mailer fails with this message:
[ERROR] 2019-03-06T20:50:42.181Z 03ed9a50-6c7b-46fe-a6f4-de54fe1a190e Error starting mailer MailerSqsQueueProcessor().
Error: sequence item 0: expected string, dict found
Traceback (most recent call last):
File "/var/task/c7n_mailer/handle.py", line 46, in start_c7n_mailer
mailer_sqs_queue_processor.run(parallel)
File "/var/task/c7n_mailer/sqs_queue_processor.py", line 128, in run
self.process_sqs_message(sqs_message)
File "/var/task/c7n_mailer/sqs_queue_processor.py", line 155, in process_sqs_message
', '.join(sqs_message['action'].get('to'))))
TypeError: sequence item 0: expected string, dict found
Is it possible to use variables like this or am I doing something wrong?
Thanks,
Matt
>>> "hello {admin-email}".format(**{'admin-email': 'xyz'})
'hello xyz'
>>> "hello { admin-email }".format(**{'admin-email': 'xyz'})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError: ' admin-email '
"hello {admin-email}".format(**{'admin-email': 'xyz'})
--
You received this message because you are subscribed to the Google Groups "cloud-custodian" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cloud-custodi...@googlegroups.com.
To post to this group, send email to cloud-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cloud-custodian/1bf88cc6-8a0d-421d-b258-9786e1f79020%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
subject: "My Subject - [custodian {{ account }} - {{ region }} - {{ admin-email }}"
I tried all of these and none of them printed the email address that I set in the accounts.yml file:
* admin-email
* {admin-email}
* { admin-email }
* {{admin-email}}
* {{ admin-email }}
I thought I set it right after double checking here:
https://github.com/cloud-custodian/cloud-custodian/tree/master/tools/c7n_org
I'm not sure what I've missed?
Thanks,
Matt