Confd忽略了在我的AWS配置上设置的角色?

时间:2019-04-08 10:45:24

标签: ssm confd

我目前正在尝试使用SSM作为密钥提供者来设置confd POC,我们目前在AWS上拥有一个帐户,该帐户是root帐户,并且具有多个角色来分隔环境。

当前我的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

我做了一个简短的测试,并在根帐户而不是角色帐户中创建了密钥/ eric,然后按预期工作,这使我感到奇怪,是否有任何隐藏的配置供confd使用“ 角色?因为目前看来它并未考虑到该角色。

我的confd模板看起来像

[template]
src = "myconfig.conf.tmpl"
dest = "/tmp/myconfig.conf"
keys = [
    "/eric"
]

我的confd配置看起来像

database_url = {{getv "/eric"}}

有人可以给我有关此特定问题的任何指导吗?

1 个答案:

答案 0 :(得分:0)

好吧,我发现了这个问题,在查看了该项目当前打开的拉取请求后,我的AWS配置已被完全忽略。

https://github.com/kelseyhightower/confd/pull/736,作者提到

  

现有会话创建会忽略AWS配置选项,除非   env var AWS_SDK_LOAD_CONFIG已导出。 SharedConfigState选项   消除了这种需求。

因此,是的,将var AWS_SDK_LOAD_CONFIG设置为true可以做到这一点,我认为当此pr得到合并时,将不需要此“解决方法”。

相关问题