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

Terraform Cognito resource server- how to pass scopes to a module #19686

Open
Nimsgs opened this issue Jun 7, 2021 · 1 comment
Open

Terraform Cognito resource server- how to pass scopes to a module #19686

Nimsgs opened this issue Jun 7, 2021 · 1 comment
Labels
question A question about existing functionality; most questions are re-routed to discuss.hashicorp.com. stale Old or inactive issues managed by automation, if no further action taken these will get closed.

Comments

@Nimsgs
Copy link

Nimsgs commented Jun 7, 2021

How can I pass the scopes if aws_cognito_resource_server is created in a module and we have to pass the scopes to that module.
eg:
I created a module for creating the cognito resources and I have to pass the scopes to that module. Tried passing the scope as a variable but it doesn't recognize the scope name and description in the module.

variable "application-scopes" {
  type = map(string)
  default = {
    scope1 = {
      "scope_name" : "get"
      "scope_description" : "can make get request"
    },
    scope2 = {
      "scope_name" : "post"
      "scope_description" : "can make post request "
    } 
  }
}

module "cognito" {
  source = "./cognito"
  scopes = var.application-scopes
}

Resource Server defined in Module:

resource "aws_cognito_resource_server" "application-resource-server" {
  identifier = var.cognito_rs_id
  name = var.cognito_rs_name
  user_pool_id = aws_cognito_user_pool.application-pool.id

  dynamic "scope" {
    for_each = [for key, value in var.scopes : {
      scope_name = value.scope_name
      scope_description = value.scope_description
    }]

    content {
      scope_name        = scope.value.scope_name
      scope_description = scope.value.scope_description
    }
  }
}
@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/cognito labels Jun 7, 2021
@breathingdust breathingdust added question A question about existing functionality; most questions are re-routed to discuss.hashicorp.com. and removed needs-triage Waiting for first response or review from a maintainer. labels Aug 31, 2021
Copy link

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

@github-actions github-actions bot added the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question A question about existing functionality; most questions are re-routed to discuss.hashicorp.com. stale Old or inactive issues managed by automation, if no further action taken these will get closed.
Projects
None yet
Development

No branches or pull requests

3 participants