Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to create resource due aws_ssm_parameter in output value for arn missed account_id #22926

Closed
KursLabIgor opened this issue Sep 27, 2019 · 2 comments

Comments

@KursLabIgor
Copy link

Terraform Version

Terraform v0.12.9
+ provider.archive v1.2.2
+ provider.aws v2.30.0
+ provider.cloudflare v1.18.1
+ provider.github v2.2.1
+ provider.local v1.3.0
+ provider.null v2.1.2
+ provider.postgresql v1.2.0
+ provider.random v2.2.1
+ provider.template v2.1.2

Terraform Configuration Files

module rds where locates secret.tf
resource "aws_ssm_parameter" "this_secret_readwrite" {
  name        = "/${replace(local.env_prefix,"-", "/")}/database/password/readwrite"
  description = "Parameter for database ${local.env_prefix} user"
  type        = "SecureString"
  value       = random_string.db_readwrite_pass.result
  tags = merge(var.common_tags, local.secret)
}
output "this_ssm_readwrite_arn" {
  value = aws_ssm_parameter.this_secret_readwrite.arn
}
main.tf
module "api_microservice" {
  source = "./modules/microservice"
 // code before 
  secrets =  [
    {
      name ="DB_PASSWORD", valueFrom = module.rds2_api_service.this_ssm_readwrite_arn
    },
    {
      name ="BROKER_PASS", valueFrom = module.rabbitmq_instance.ssm_parameter_arn_rabbitmq_admin_pass
    }
  ]
// code after
}

Debug Output

2019/09/27 14:10:02 [ERROR] module.api_microservice: eval: *terraform.EvalSequence, err: ClientException: The Systems Manager parameter ARN specified for secret DB_PASSWORD has a different account ID than the current account. The current account ID is XXXXXXXXX and the ARN account ID is . Cross-account access for ARNs is not currently supported.
        status code: 400, request id: fb14d105-54aa-4bdb-9ab3-1f8725af83c1
2019/09/27 14:10:02 [TRACE] [walkApply] Exiting eval tree: module.api_microservice.aws_ecs_task_definition.this_task_definition

Crash Output

no

Expected Behavior

Configuration same as for terraform 0.11. But for 0.12 doesnt work.
SSM_PARAMETER ARN should be like
"arn:aws:ssm:region:aws_account_id:parameter/parameter_name"

Actual Behavior

Error: ClientException: The Systems Manager parameter ARN specified for secret BROKER_PASS has a different account ID than the current account. The current account ID is XXXXXXXX and the ARN account ID is . Cross-account access for ARNs is not currently supported.
        status code: 400, request id: 97198d39-6f8f-42d8-b775-1fb555009b62

  on modules/microservice/task_definition.tf line 7, in resource "aws_ecs_task_definition" "this_task_definition":
   7: resource "aws_ecs_task_definition" "this_task_definition" {

Seem like in ARN account id is empty .
During plan i see ARN like:

+ secrets           = [
                      + {
                          + name      = "DB_PASSWORD"
                          + valueFrom = "arn:aws:ssm:us-west-2::parameter/x/x/api/database/password/readwrite"
                        },
                      + {
                          + name      = "BROKER_PASS"
                          + valueFrom = "arn:aws:ssm:us-west-2::parameter/x/x/rabbitmq/admin/pass"
                        },
                    ]

Actual ARN:
"arn:aws:ssm:region::parameter/parameter_name"
account_id - is missed

Steps to Reproduce

  1. create SSM resource
  2. add arn as output value
  3. Inspect arn

Additional Context

See AWS docs secrets section
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#container_definition_security

References

@ghost
Copy link

ghost commented Sep 27, 2019

This issue has been automatically migrated to hashicorp/terraform-provider-aws#10274 because it looks like an issue with that provider. If you believe this is not an issue with the provider, please reply to hashicorp/terraform-provider-aws#10274.

@ghost
Copy link

ghost commented Oct 28, 2019

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Oct 28, 2019
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants