【问题标题】:Trying to use Terragrunt (terraform) with Okta尝试将 Terragrunt (terraform) 与 Okta 一起使用
【发布时间】:2018-12-31 12:59:39
【问题描述】:

我正在尝试在 Terragrunt 中利用 Okta 的使用,并且在担任该角色时遇到了一些问题。 我的 ~/.aws/config 文件

aws_saml_url = home/amazon_aws/XXXXXXXXX/XXXXXXXXX

[profile assume-admin]
role_arn = arn:aws:iam::XXXXXXXXX:role/assumeAdmin
region = us-west-2

[profile dev]
source_profile = assume-admin
role_arn = arn:aws:iam::XXXXXXXXX:role/adminUser

没有 terragrunt,只使用 Terraform 和 Okta,我没有发现任何问题。

$ aws-okta exec dev -- bash
$ terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

data.terraform_remote_state.bastion: Refreshing state...
data.terraform_remote_state.vpc: Refreshing state...
data.terraform_remote_state.bastion: Refreshing state...
data.terraform_remote_state.vpc: Refreshing state...
data.aws_caller_identity.current: Refreshing state...

SNIP

Plan: 0 to add, 2 to change, 0 to destroy.

Note: You didn't specify an "-out" parameter to save this plan, so Terraform
can't guarantee that exactly these actions will be performed if
"terraform apply" is subsequently run.

现在使用 Terragrunt

terragrunt plan
[terragrunt] [/Users/user/dev/infrastructure/terraform/accounts/dev/us-west-2/dev/app] 2018/07/23 17:32:56 Running command: terraform --version
[terragrunt] 2018/07/23 17:32:56 Reading Terragrunt config file at /Users/user/dev/infrastructure/terraform/accounts/dev/us-west-2/dev/app/terraform.tfvars
[terragrunt] 2018/07/23 17:32:56 Backend s3 has not changed.
[terragrunt] 2018/07/23 17:32:56 Error initializing session: SharedConfigAssumeRoleError: failed to load assume role for arn:aws:iam::XXXXXXXXX:role/adminUser, source profile has no shared credentials
[terragrunt] 2018/07/23 17:32:56 Unable to determine underlying exit code, so Terragrunt will exit with error code 1

谢谢。

【问题讨论】:

    标签: terraform okta terragrunt


    【解决方案1】:

    我能够通过在执行 aws-okta exec takt-dev -- bash 后设置 AWS_CONFIG_FILE=/dev/null 来解决此问题,这会加载我的 AWS_* 凭据/变量。

    使用AWS_PROFILE=PROFILE_NAME 或使用unset AWS_* 未定义shell 变量将返回我上面提到的错误。

    仅供参考。我正在运行 Terraform v0.11.7

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-06-15
      • 2021-10-13
      • 2018-06-08
      • 2016-03-25
      • 2013-12-25
      • 2014-09-01
      • 1970-01-01
      相关资源
      最近更新 更多