Created
July 17, 2020 11:32
-
-
Save riussi/b0b40e34b9301722febe8f6b6d093d08 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Configure the GitHub Provider | |
provider "github" { | |
organization = "riussi-eu" | |
} | |
# Add a user to the organization | |
resource "github_membership" "membership_for_riussi" { | |
username = "riussi" | |
role = "admin" | |
} | |
# Add the SSH-key for the user | |
resource "github_user_ssh_key" "ssh-key-riussi" { | |
title = "riussi-eu-ssh-key-riussi" | |
key = "${file("../ssh-keys/riussi-id_ed25519.pub")}" | |
} | |
# Add a Developers-team to the organization | |
resource "github_team" "developers" { | |
name = "developers" | |
description = "All developers" | |
privacy = "closed" | |
} | |
# Add a Infrastructure-team to the organization | |
resource "github_team" "infrastructure" { | |
name = "infrastructure" | |
description = "All SRE" | |
privacy = "closed" | |
} | |
# Add member to team | |
resource "github_team_membership" "developers_team_membership" { | |
team_id = "${github_team.developers.id}" | |
username = "riussi" | |
role = "maintainer" | |
} | |
resource "github_team_membership" "infrastructure_team_membership" { | |
team_id = "${github_team.infrastructure.id}" | |
username = "riussi" | |
role = "maintainer" | |
} | |
# Add a repository | |
resource "github_repository" "infrastructure" { | |
name = "infrastructure" | |
description = "Infrastructure as code" | |
auto_init = true | |
private = true | |
has_issues = true | |
has_projects = true | |
has_wiki = true | |
license_template = "mit" | |
topics = ["infrastructure", "terraform", "iac"] | |
} | |
resource "github_repository_file" "gitignore" { | |
repository = "infrastructure" | |
file = ".gitignore" | |
content = "**/*.tfstate*\n**/.terraform/*\n*.tfvars" | |
} | |
resource "github_repository_project" "infrastructure-project" { | |
name = "Infrastructure Project" | |
repository = "${github_repository.infrastructure.name}" | |
body = "The infrastructure as code project." | |
} | |
resource "github_team_repository" "infrastructure" { | |
team_id = "${github_team.infrastructure.id}" | |
repository = "${github_repository.infrastructure.name}" | |
permission = "maintain" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment