简体   繁体   中英

terraform cant access module output

In Terraform using this cognito module

https://github.com/lgallard/terraform-aws-cognito-user-pool/blob/master/outputs.tf#L34

I'm not able to access the Output Variable

output "domain_cloudfront_distribution_arn" {
  description = "The ARN of the CloudFront distribution"
  value       = var.enabled ? join("", module.aws_cognito_user_pool_stardust.domain.*.cloudfront_distribution_arn) : null
}

Throws me this error

❯ terraform apply  -var-file fixtures.us-east-1.tfvars   -auto-approve
Acquiring state lock. This may take a few moments...
module.aws_cognito_user_pool_stardust.aws_cognito_user_pool.pool[0]: Refreshing state... [id=us-east-1_wEWpH9pmy]
module.aws_cognito_user_pool_stardust.aws_cognito_user_pool_domain.domain[0]: Refreshing state... [id=stardust-admin-dashboard-dev]
module.aws_cognito_user_pool_stardust.aws_cognito_identity_provider.identity_provider[0]: Refreshing state... [id=us-east-1_wEWpH9pmy:Google]
module.aws_cognito_user_pool_stardust.aws_cognito_user_group.main[1]: Refreshing state... [id=us-east-1_wEWpH9pmy/players]
module.aws_cognito_user_pool_stardust.aws_cognito_user_group.main[0]: Refreshing state... [id=us-east-1_wEWpH9pmy/owners]
module.aws_cognito_user_pool_stardust.aws_cognito_user_pool_client.client[1]: Refreshing state... [id=kifo1avcbbd2hn7phraa1fbca]
module.aws_cognito_user_pool_stardust.aws_cognito_user_pool_client.client[0]: Refreshing state... [id=4dpv821e9biuve5ri9ka319ecr]
╷
│ Error: Unsupported attribute
│
│   on outputs.tf line 18, in output "domain_cloudfront_distribution_arn":
│   18:   value       = var.enabled ? join("", module.aws_cognito_user_pool_stardust.domain.*.cloudfront_distribution_arn) : null
│     ├────────────────
│     │ module.aws_cognito_user_pool_stardust is object with 14 attributes
│
│ This object does not have an attribute named "domain".
╵
Releasing state lock. This may take a few moments...

This is my main.tf file

module "aws_cognito_user_pool_stardust" {

  source  = "lgallard/cognito-user-pool/aws"
  version = "0.14.2"
  .....

}

This is definition inside the module:

output "domain_cloudfront_distribution_arn" {
  description = "The ARN of the CloudFront distribution"
  value       = var.enabled ? join("", aws_cognito_user_pool_domain.domain.*.cloudfront_distribution_arn) : null
}

What you want to do is just to pass it through as an output from the main module, therefore on your side you need to define:

output "domain_cloudfront_distribution_arn" {
  description = "The ARN of the CloudFront distribution"
  value       = module.aws_cognito_user_pool_stardust.domain_cloudfront_distribution_arn
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM