GithubHelp home page GithubHelp logo

hashicorp / learn-terraform-github-user-teams Goto Github PK

View Code? Open in Web Editor NEW
18.0 14.0 37.0 25 KB

Home Page: https://learn.hashicorp.com/tutorials/terraform/github-user-teams

License: Mozilla Public License 2.0

HCL 100.00%
terraform hashicorp tutorial github

learn-terraform-github-user-teams's Introduction

learn-terraform-github-user-teams's People

Contributors

calebalbers avatar duplo83 avatar hashicorp-copywrite[bot] avatar im2nguyen avatar robin-norwood avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

learn-terraform-github-user-teams's Issues

Adding new team to teams.csv returns error with terraform plan

When trying to add a new team to the org by adding it to the CSV file I am getting the following error:

│ Error: Invalid for_each argument
│ 
│   on teams.tf line 15, in resource "github_team_membership" "members":
│   15:   for_each = { for tm in local.team_members : tm.name => tm }
│     ├────────────────
│     │ local.team_members will be known only after apply
│ 
│ The "for_each" value depends on resource attributes that cannot be determined until apply, so Terraform cannot predict how many instances will be created. To work around this, use the -target argument to first apply only the
│ resources that the for_each depends on.

I get the error with or without the respective team csv file existing in the team-members folder.

If I add the team via the gui first and then import the team I'm able to get the plan and apply to work.

Error: This resource can only be used in the context of an organization, "" is a user.

I get these two error messages:

Error: This resource can only be used in the context of an organization, "" is a user.

│ with github_team.all["Developer Team"],
│ on teams.tf line 4, in resource "github_team" "all":
│ 4: resource "github_team" "all" {



│ Error: This resource can only be used in the context of an organization, "" is a user.

│ with github_team.all["Security Team"],
│ on teams.tf line 4, in resource "github_team" "all":
│ 4: resource "github_team" "all" {

What does it mean and how can I fix it?

DRY the github_team_repository resource config

Is it possible to use a nested loop to iterate through each file in repos-team and set the team and respective permission for the repo ... instead of defining a configuration block for each repo as it is in ./repositories.tf?

# Add memberships for application repository
resource "github_team_repository" "application" {
  for_each = {
    for team in local.repo_teams_files["application"] :
    team.team_name => {
      team_id    = github_team.all[team.team_name].id
      permission = team.permission
    } if lookup(github_team.all, team.team_name, false) != false
  }

  team_id    = each.value.team_id
  repository = github_repository.application.id
  permission = each.value.permission
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.