简体   繁体   English

terraform 无法访问模块 output

[英]terraform cant access module output

In Terraform using this cognito module在 Terraform 中使用此认知模块

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

I'm not able to access the Output Variable我无法访问 Output 变量

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这是我的main.tf文件

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 从主模块传递,因此你需要定义:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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