Skip to content

Commit

Permalink
nested for loops
Browse files Browse the repository at this point in the history
  • Loading branch information
jabez007 committed Jul 28, 2024
1 parent 24168ca commit 2e981be
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ data "github_repositories" "my_topics" {

resource "github_repository_environment" "environments" {
for_each = {
for repo in data.github_repositories.my_topics.results : repo.name => repo.name
for repo in data.github_repositories.my_topics : repo.name => [
for env in local.environments : {
repository = repo.name
environment = env
}
]
}

repository = each.value

dynamic "environment" {
for_each = local.environments
content {
name = environment.value
}
}
repository = each.value.repository
environment = each.value.environment
}

0 comments on commit 2e981be

Please sign in to comment.