From aff2ec6811b4e574e373d309dda1dcef32d4d4ae Mon Sep 17 00:00:00 2001 From: Andre Licht Date: Mon, 25 Nov 2024 16:49:11 +0100 Subject: [PATCH] fix module-repo-setup Signed-off-by: Andre Licht Signed-off-by: Andre Licht --- ...etup is tainted, so it must be replaced.md | 16 +++++-- terraform/module-repo-setup.tf | 19 +++----- terraform/modules/github_repository/main.tf | 43 ++++++------------- .../modules/github_repository/terraform.tf | 10 +++++ .../modules/github_repository/variables.tf | 11 +++++ terraform/terraform.tf | 14 ++++++ terraform/variables.tf | 2 +- 7 files changed, 69 insertions(+), 46 deletions(-) create mode 100644 terraform/modules/github_repository/terraform.tf create mode 100644 terraform/modules/github_repository/variables.tf create mode 100644 terraform/terraform.tf diff --git a/docs/Troubleshoot - Terraform module-repo-setup is tainted, so it must be replaced.md b/docs/Troubleshoot - Terraform module-repo-setup is tainted, so it must be replaced.md index 199e347..d5fce65 100644 --- a/docs/Troubleshoot - Terraform module-repo-setup is tainted, so it must be replaced.md +++ b/docs/Troubleshoot - Terraform module-repo-setup is tainted, so it must be replaced.md @@ -41,7 +41,17 @@ OpenTofu planned the following actions, but then encountered a problem: ╵ ``` -## Solution +## Solution 1 - state untaint + +The Repository is already created in Github and the Terraform state is not in sync with the actual state of the repository. + +This may occur if terraform apply was interrupted or failed while creating the repository. + +```bash +tofu untaint "module.github_repository[\"terraform-azurerm-avd\"].github_repository.repository" +``` + +## Solution 2 - remove and re-add