Slide 1

Slide 1 text

Managing GitHub with Terraform

Slide 2

Slide 2 text

Terraform

Slide 3

Slide 3 text

• built to codify infrastructure resources • wide support for different providers • flow based on HashiCorp Configura

Slide 4

Slide 4 text

HashiCorp Configura/on Language

Slide 5

Slide 5 text

service { key = "value" }

Slide 6

Slide 6 text

service { acl = "private" ... env = "development" }

Slide 7

Slide 7 text

Terraform flow

Slide 8

Slide 8 text

• terraform init • terraform get • terraform plan • terraform apply • terraform destroy • terraform graph

Slide 9

Slide 9 text

Code

Slide 10

Slide 10 text

# _providers.tf provider "github" { organization = "my-organization" token = "${var.github_token}" version = "~> 0.1" }

Slide 11

Slide 11 text

# terraform.tfvars github_token = "6a2...2f7"

Slide 12

Slide 12 text

# github_teams.tf resource "github_team" "frontend" { name = "frontend" description = "Team: frontend" privacy = "closed" }

Slide 13

Slide 13 text

# github_memberships.tf resource "github_membership" "jane" { username = "jane" role = "member" }

Slide 14

Slide 14 text

# github_team_memberships.tf resource "github_team_membership" "jane" { team_id = "${github_team.frontend.id}" username = "jane" role = "member" }

Slide 15

Slide 15 text

# github_repositories.tf module "infra" { source = "github.com/my-organization/terraform-github-repository-my-organization" name = "infra" description = "Infrastructure" req_status_checks_context = ["continuous-integration/travis-ci"] auto_init = false gitignore_template = "" team_repository_team = "${github_team.operations.id}" enable_branch_protection = 0 req_pr_reviews_dismissal_teams = ["${github_team.operations.id}"] restrictions_teams = ["${github_team.operations.id}"] }

Slide 16

Slide 16 text

# github_repositories.tf module "infra" { source = "github.com/my-organization/terraform-github-repository-my-organization" name = "infra" description = "Infrastructure" req_status_checks_context = ["continuous-integration/travis-ci"] auto_init = false gitignore_template = "" team_repository_team = "${github_team.operations.id}" enable_branch_protection = 1 req_pr_reviews_dismissal_teams = ["${github_team.operations.id}"] restrictions_teams = ["${github_team.operations.id}"] }

Slide 17

Slide 17 text

# github_repositories.tf module "infra" { source = "github.com/my-organization/terraform-github-repository-my-organization" name = "infra" description = "Infrastructure" req_status_checks_context = ["continuous-integration/travis-ci"] auto_init = false gitignore_template = "" team_repository_team = "${github_team.operations.id}" enable_branch_protection = 1 req_pr_reviews_dismissal_teams = ["${github_team.operations.id}"] restrictions_teams = ["${github_team.operations.id}"] }

Slide 18

Slide 18 text

# github_repositories.tf module "infra" { source = "github.com/my-organization/terraform-github-repository-my-organization" name = "infra" description = "Infrastructure" req_status_checks_context = ["continuous-integration/travis-ci"] auto_init = false gitignore_template = "" team_repository_team = "${github_team.operations.id}" enable_branch_protection = 1 req_pr_reviews_dismissal_teams = ["${github_team.operations.id}"] restrictions_teams = ["${github_team.operations.id}"] }

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

Fin