我想通过基于列表变量(email_addresses)的 loping 使用 terraform template_file 创建 CFT。以下是我尝试生成的变量和模板。
variables:-
emails_addresses = ["sample-1@gmail.com", "sample-2@gmail.com"]
sns_arn = "arn:aws:sns:us-east-1:xxxxxx:xxxx"
protocol = "email"
Run Code Online (Sandbox Code Playgroud)
期待模板:
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"sample-1": {
"Type": "AWS::SNS::Subscription",
"Properties": {
"Endpoint": "sample-1@gmail.com",
"Protocol": "email",
"TopicArn": "arn:aws:sns:us-east-1:xxxx:xxxxx"
}
},
"sample-2": {
"Type": "AWS::SNS::Subscription",
"Properties": {
"Endpoint": "sample-2@gmil.com",
"Protocol": "email",
"TopicArn": "arn:aws:sns:us-east-1:xxx:xxxx"
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
CFT 中的资源名称可以是一些随机字符串,但在多个计划/应用的情况下,每个邮件应该相同。
amazon-web-services amazon-sns terraform terraform-provider-aws