我目前正在尝试使用 SSM 作为密钥提供者来设置一个 confd POC,我们目前在 AWS 上有一个帐户,它是根帐户和多个角色来分隔环境。
目前我的 AWS 配置看起来像这样
[default]
region=eu-west-1
output=json
role_arn=arn:aws:iam::*:role/OrganizationAccountAccessRole
给定命令,这对我来说很好
aws ssm get-parameters --names /eric
把我为这个 poc 创建的密钥还给我
PARAMETERS arn:aws:ssm:eu-west-1:*:parameter/eric * /eric String test 1
对于 confd 虽然它没有
confd -onetime -backend ssm --log-level debug
2019-04-07T18:25:08Z 3ce95f057568 confd[359]: DEBUG Processing key=/eric
2019-04-07T18:25:08Z 3ce95f057568 confd[359]: DEBUG Got the following map from store: map[]
2019-04-07T18:25:08Z 3ce95f057568 confd[359]: DEBUG Using source template /etc/confd/templates/myconfig.conf.tmpl
2019-04-07T18:25:08Z 3ce95f057568 confd[359]: DEBUG Compiling source template /etc/confd/templates/myconfig.conf.tmpl
2019-04-07T18:25:08Z 3ce95f057568 confd[359]: ERROR template: myconfig.conf.tmpl:2:17: executing "myconfig.conf.tmpl" at <getv "/eric">: error calling getv: key does not exist: /eric
2019-04-07T18:25:08Z 3ce95f057568 confd[359]: FATAL template: myconfig.conf.tmpl:2:17: executing "myconfig.conf.tmpl" at <getv "/eric">: error calling getv: key does not exist: /eric
我做了一个简短的测试,并在 root 帐户而不是角色帐户中创建了密钥 /eric,之后它按我的预期工作,这让我想知道,是否有任何隐藏的配置 confd 使其“使用”角色? 因为目前它似乎没有考虑到这个角色。
我的 confd 模板看起来像
[template]
src = "myconfig.conf.tmpl"
dest = "/tmp/myconfig.conf"
keys = [
"/eric"
]
我的 confd 配置看起来像
database_url = {{getv "/eric"}}
有人可以就这个具体问题给我任何指导吗?