【问题标题】:Confd ignores the role set on my aws config?Confd 忽略了我的 aws 配置中设置的角色?
【发布时间】:2019-04-08 19:45:38
【问题描述】:

我目前正在尝试使用 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"}}

有人可以就这个具体问题给我任何指导吗?

【问题讨论】:

    标签: ssm confd


    【解决方案1】:

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

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

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

    所以是的,将 var AWS_SDK_LOAD_CONFIG 设置为 true 做到了这一点,我假设当这个 pr 得到合并时,这个“解决方法”将是没有必要的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-04-12
      • 1970-01-01
      • 2017-04-29
      • 2018-11-10
      • 2015-09-04
      • 2023-04-09
      • 2015-08-31
      • 2012-09-07
      相关资源
      最近更新 更多