mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-08 15:13:56 -06:00
631b0b865c
Here we add a basic provider with a single resource type. It's copied heavily from the `github` provider and `github_repository` resource, as there is some overlap in those types/apis. ~~~ resource "gitlab_project" "test1" { name = "test1" visibility_level = "public" } ~~~ We implement in terms of the [go-gitlab](https://github.com/xanzy/go-gitlab) library, which provides a wrapping of the [gitlab api](https://docs.gitlab.com/ee/api/) We have been a little selective in the properties we surface for the project resource, as not all properties are very instructive. Notable is the removal of the `public` bool as the `visibility_level` will take precedent if both are supplied which leads to confusing interactions if they disagree.
36 lines
769 B
Go
36 lines
769 B
Go
package gitlab
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/hashicorp/terraform/helper/schema"
|
|
"github.com/hashicorp/terraform/terraform"
|
|
)
|
|
|
|
var testAccProviders map[string]terraform.ResourceProvider
|
|
var testAccProvider *schema.Provider
|
|
|
|
func init() {
|
|
testAccProvider = Provider().(*schema.Provider)
|
|
testAccProviders = map[string]terraform.ResourceProvider{
|
|
"gitlab": testAccProvider,
|
|
}
|
|
}
|
|
|
|
func TestProvider(t *testing.T) {
|
|
if err := Provider().(*schema.Provider).InternalValidate(); err != nil {
|
|
t.Fatalf("err: %s", err)
|
|
}
|
|
}
|
|
|
|
func TestProvider_impl(t *testing.T) {
|
|
var _ terraform.ResourceProvider = Provider()
|
|
}
|
|
|
|
func testAccPreCheck(t *testing.T) {
|
|
if v := os.Getenv("GITLAB_TOKEN"); v == "" {
|
|
t.Fatal("GITLAB_TOKEN must be set for acceptance tests")
|
|
}
|
|
}
|