Lerentis / terraform-provider-gitea

Terraform Provider for your Gitea Instance
https://registry.terraform.io/providers/Lerentis/gitea/latest
MIT License
22 stars 11 forks source link

Add Scope for Resource_Gitea_Token #53

Open David-Elizondo opened 1 year ago

David-Elizondo commented 1 year ago

Token scope was added to Gitea Tokens in V0.16+. The official Gitea SDK has not released a official version in 2years. The Implementation does exists in the default branch (Thanks John Olheiser).

Until the SDK has an official release of this feature it's not advisable to merge this PR into your provider.

But in the mean time, I've added this scope attr resource to be able to handle this new feature.

Updates:

Workaround:

Install this branch locally with the existing makefile. make install and point provider to local install and operate terraform as usual.

terraform {
  required_providers {
    gitea = {
      source  = "terraform.local/lerentis/gitea"
      version = "0.16.1"
    }
  }
}

Example Usage:

terraform {
  required_providers {
    gitea = {
      source  = "terraform.local/lerentis/gitea"
      version = "0.16.1"
    }
  }
}

provider "gitea" {
  base_url = "http://localhost:3000/" 
  username = "root"                     
  password = "root"                     
}

resource "gitea_token" "test" {
  username = "root"
  name     = "test"
  scope    = ["write:organization","write:user"]
}

resource "gitea_token" "test2" {
  username = "root"
  name     = "test2"
  scope    = ["all"]
}

resource "gitea_token" "test3" {
  username = "root"
  name     = "test3"
  scope    = ["public-only","all"]
}
David-Elizondo commented 1 year ago

Hello @Lerentis ! Made the changes requested, thanks for the review!