GEN004 - Github repository shouldn't be public.

Explanation

Github repository should be set to be private.

You can do this by either setting private attribute to ‘true’ or visibility attribute to ‘internal’ or ‘private’.

Insecure Example

The following example will fail the GEN004 check.

resource "github_repository" "bad_example" {
  name        = "example"
  description = "My awesome codebase"

  visibility  = "public"

  template {
    owner = "github"
    repository = "terraform-module-template"
  }
}

Secure Example

The following example will pass the GEN004 check.

resource "github_repository" "good_example" {
  name        = "example"
  description = "My awesome codebase"

  visibility  = "private"

  template {
    owner = "github"
    repository = "terraform-module-template"
  }
}