terraform-provider-tfe
terraform-provider-tfe copied to clipboard
add ability to read an organization membership by org membership id
This will be useful in case you need to read all organization memberships and pull out information such as emails of all users so that it can be used to create downstream resources, example:
data "tfe_organization_members" "users" {
organization = var.tfc_org
}
data "tfe_organization_membership" "test" {
for_each = toset([
for index, member in data.tfe_organization_members.users.members :
member.organization_membership_id
])
organization = var.tfc_org
organization_membership_id = each.value
}
output "user_emails" {
value = [
for index, member in data.tfe_organization_membership.test :
member.email
]
}
Related issue: #871
Description
Describe why you're making this change.
Remember to:
- [ ] Update the Change Log
- [ ] Update the Documentation
Testing plan
- Describe how to replicate
- the conditions
- under which your code performs its purpose,
- including example Terraform configs where necessary.
External links
Include any links here that might be helpful for people reviewing your PR. If there are none, feel free to delete this section.
Output from acceptance tests
Please run applicable acceptance tests locally and include the output here. See testing.md to learn how to run acceptance tests.
If you are an external contributor, your contribution(s) will first be reviewed before running them against the project's CI pipeline.
$ TESTARGS="-run TestAccTFEWorkspace" make testacc
...