resource "jenkins_folder" "common" {
  name        = "common"
  description = "common projects"

  security {
    inheritance_strategy = "org.jenkinsci.plugins.matrixauth.inheritance.InheritParentStrategy"
    permissions = [
      "GROUP:hudson.model.Item.Build:theorchard*apollo-team",
      "GROUP:hudson.model.Item.Build:theorchard*atlas-team",
      "GROUP:hudson.model.Item.Build:theorchard*decibel-team",
      "GROUP:hudson.model.Item.Build:theorchard*delphi-team",
      "GROUP:hudson.model.Item.Build:theorchard*dna-team",
      "GROUP:hudson.model.Item.Build:theorchard*rti-team",
      "GROUP:hudson.model.Item.Cancel:theorchard*apollo-team",
      "GROUP:hudson.model.Item.Cancel:theorchard*atlas-team",
      "GROUP:hudson.model.Item.Cancel:theorchard*decibel-team",
      "GROUP:hudson.model.Item.Cancel:theorchard*delphi-team",
      "GROUP:hudson.model.Item.Cancel:theorchard*dna-team",
      "GROUP:hudson.model.Item.Cancel:theorchard*rti-team",
      "GROUP:hudson.model.Item.Read:theorchard*apollo-team",
      "GROUP:hudson.model.Item.Read:theorchard*atlas-team",
      "GROUP:hudson.model.Item.Read:theorchard*decibel-team",
      "GROUP:hudson.model.Item.Read:theorchard*delphi-team",
      "GROUP:hudson.model.Item.Read:theorchard*dna-team",
      "GROUP:hudson.model.Item.Read:theorchard*orcharddevs-ro",
      "GROUP:hudson.model.Item.Read:theorchard*rti-team",
      "GROUP:hudson.model.Item.Workspace:theorchard*apollo-team",
      "GROUP:hudson.model.Item.Workspace:theorchard*atlas-team",
      "GROUP:hudson.model.Item.Workspace:theorchard*decibel-team",
      "GROUP:hudson.model.Item.Workspace:theorchard*delphi-team",
      "GROUP:hudson.model.Item.Workspace:theorchard*dna-team",
      "GROUP:hudson.model.Item.Workspace:theorchard*rti-team",
      "GROUP:hudson.model.View.Read:theorchard*apollo-team",
      "GROUP:hudson.model.View.Read:theorchard*atlas-team",
      "GROUP:hudson.model.View.Read:theorchard*decibel-team",
      "GROUP:hudson.model.View.Read:theorchard*delphi-team",
      "GROUP:hudson.model.View.Read:theorchard*dna-team",
      "GROUP:hudson.model.View.Read:theorchard*orcharddevs-ro",
      "GROUP:hudson.model.View.Read:theorchard*rti-team",
    ]
  }
}

resource "jenkins_folder" "common_pipelines" {
  name        = "pipelines"
  folder      = jenkins_folder.common.id
  description = "common pipelines"
}
