Import pre-existing Gitea branch protections
Why: - tofu apply fails with "Branch protection already exist" because the nine repos protected in #60 already have live branch protection in Gitea that is absent from Terraform state, so Terraform tries to create rules that already exist and Gitea rejects them. - The pinned go-gitea/gitea provider 0.7.0 defines no importer for gitea_repository_branch_protection, so the existing rules cannot be adopted on that version. How: - Bump the gitea provider from 0.7.0 to 0.8.1, which adds an importer for gitea_repository_branch_protection (id format <org>/<repo>/<rule_name>). - Add import blocks adopting the nine existing branch protections into state instead of recreating them.
This commit is contained in:
@@ -203,3 +203,50 @@ import {
|
||||
id = "144"
|
||||
}
|
||||
|
||||
# Branch protections that already exist in Gitea but are not yet in state.
|
||||
# Import id format is <organisation>/<repository>/<rule_name>.
|
||||
import {
|
||||
to = module.branch_protection["git.unkin.net/unkin/app-sudaporn-research-individual/master"].gitea_repository_branch_protection.this
|
||||
id = "unkin/app-sudaporn-research-individual/master"
|
||||
}
|
||||
|
||||
import {
|
||||
to = module.branch_protection["git.unkin.net/unkin/app-sudaporn-research-normalised/master"].gitea_repository_branch_protection.this
|
||||
id = "unkin/app-sudaporn-research-normalised/master"
|
||||
}
|
||||
|
||||
import {
|
||||
to = module.branch_protection["git.unkin.net/unkin/benvin-utils/main"].gitea_repository_branch_protection.this
|
||||
id = "unkin/benvin-utils/main"
|
||||
}
|
||||
|
||||
import {
|
||||
to = module.branch_protection["git.unkin.net/unkin/container-devcompute/main"].gitea_repository_branch_protection.this
|
||||
id = "unkin/container-devcompute/main"
|
||||
}
|
||||
|
||||
import {
|
||||
to = module.branch_protection["git.unkin.net/unkin/docker-template/master"].gitea_repository_branch_protection.this
|
||||
id = "unkin/docker-template/master"
|
||||
}
|
||||
|
||||
import {
|
||||
to = module.branch_protection["git.unkin.net/unkin/initbuilder/main"].gitea_repository_branch_protection.this
|
||||
id = "unkin/initbuilder/main"
|
||||
}
|
||||
|
||||
import {
|
||||
to = module.branch_protection["git.unkin.net/unkin/puppetapi/master"].gitea_repository_branch_protection.this
|
||||
id = "unkin/puppetapi/master"
|
||||
}
|
||||
|
||||
import {
|
||||
to = module.branch_protection["git.unkin.net/unkin/rpmbuild-internal-ca-certificates/master"].gitea_repository_branch_protection.this
|
||||
id = "unkin/rpmbuild-internal-ca-certificates/master"
|
||||
}
|
||||
|
||||
import {
|
||||
to = module.branch_protection["git.unkin.net/unkin/streamstack/main"].gitea_repository_branch_protection.this
|
||||
id = "unkin/streamstack/main"
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ terraform {
|
||||
required_providers {
|
||||
gitea = {
|
||||
source = "go-gitea/gitea"
|
||||
version = "0.7.0"
|
||||
version = "0.8.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ terraform {
|
||||
required_providers {
|
||||
gitea = {
|
||||
source = "go-gitea/gitea"
|
||||
version = "0.7.0"
|
||||
version = "0.8.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ terraform {
|
||||
required_providers {
|
||||
gitea = {
|
||||
source = "go-gitea/gitea"
|
||||
version = "0.7.0"
|
||||
version = "0.8.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ terraform {
|
||||
required_providers {
|
||||
gitea = {
|
||||
source = "go-gitea/gitea"
|
||||
version = "0.7.0"
|
||||
version = "0.8.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ terraform {
|
||||
required_providers {
|
||||
gitea = {
|
||||
source = "go-gitea/gitea"
|
||||
version = "0.7.0"
|
||||
version = "0.8.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ terraform {
|
||||
required_providers {
|
||||
gitea = {
|
||||
source = "go-gitea/gitea"
|
||||
version = "0.7.0"
|
||||
version = "0.8.1"
|
||||
}
|
||||
random = {
|
||||
source = "hashicorp/random"
|
||||
|
||||
@@ -3,7 +3,7 @@ terraform {
|
||||
required_providers {
|
||||
gitea = {
|
||||
source = "go-gitea/gitea"
|
||||
version = "0.7.0"
|
||||
version = "0.8.1"
|
||||
}
|
||||
woodpecker = {
|
||||
source = "Kichiyaki/woodpecker"
|
||||
|
||||
Reference in New Issue
Block a user