From 8cec23db58be57468ddf7c448b1c4636a5fdea9b Mon Sep 17 00:00:00 2001 From: Dennis Sobczak Date: Fri, 24 Feb 2023 00:21:05 +0100 Subject: [PATCH] working example of terraform github - only working if provider is specified in modules main.tf file - possible mitigation -> https://github.com/integrations/terraform-provider-github/issues/652 --- terraform_github/.gitignore | 4 ++++ terraform_github/main.tf | 3 +++ terraform_github/modules/github/main.tf | 19 +++++++++++++++++++ terraform_github/provider.tf | 6 ++++++ terraform_github/versions.tf | 9 +++++++++ 5 files changed, 41 insertions(+) create mode 100644 terraform_github/.gitignore create mode 100644 terraform_github/main.tf create mode 100644 terraform_github/modules/github/main.tf create mode 100644 terraform_github/provider.tf create mode 100644 terraform_github/versions.tf diff --git a/terraform_github/.gitignore b/terraform_github/.gitignore new file mode 100644 index 0000000..42a3e87 --- /dev/null +++ b/terraform_github/.gitignore @@ -0,0 +1,4 @@ +.terraform.lock.hcl +terraform.tfstate +terraform.tfstate.backup +.terraform diff --git a/terraform_github/main.tf b/terraform_github/main.tf new file mode 100644 index 0000000..6761b49 --- /dev/null +++ b/terraform_github/main.tf @@ -0,0 +1,3 @@ +module "github" { + source = "./modules/github" +} diff --git a/terraform_github/modules/github/main.tf b/terraform_github/modules/github/main.tf new file mode 100644 index 0000000..81f5fc0 --- /dev/null +++ b/terraform_github/modules/github/main.tf @@ -0,0 +1,19 @@ +provider "github" { + token = "" + owner = "" +} + +resource "github_repository" "example" { + name = "example" + description = "My awesome codebase" + + visibility = "public" + +/* + template { + owner = "" + repository = "terraform-template-module" + include_all_branches = true + } +*/ +} diff --git a/terraform_github/provider.tf b/terraform_github/provider.tf new file mode 100644 index 0000000..09837fe --- /dev/null +++ b/terraform_github/provider.tf @@ -0,0 +1,6 @@ +/* +provider "github" { + token = "" + owner = "" +} +*/ diff --git a/terraform_github/versions.tf b/terraform_github/versions.tf new file mode 100644 index 0000000..01d076f --- /dev/null +++ b/terraform_github/versions.tf @@ -0,0 +1,9 @@ +terraform { + required_version = "~> 1.3" + required_providers { + github = { + source = "integrations/github" + version = "~> 4.0" + } + } +}