Skip to content

Commit

Permalink
provider initial
Browse files Browse the repository at this point in the history
  • Loading branch information
DrFaust92 committed Nov 11, 2023
1 parent 6a33821 commit 83bc6e7
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 41 deletions.
8 changes: 5 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "Mapbox Provider"
page_title: "mapbox Provider"
subcategory: ""
description: |-
---

# Mapbox Provider
# mapbox Provider



## Example Usage

Expand All @@ -21,4 +23,4 @@ provider "mapbox" {

### Optional

- `endpoint` (String) Example provider attribute
- `access_token` (String) Access token to authenticate to mapbox with
31 changes: 0 additions & 31 deletions docs/resources/scaffolding_example.md

This file was deleted.

34 changes: 34 additions & 0 deletions docs/resources/token.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "mapbox_token Resource - terraform-provider-mapbox"
subcategory: ""
description: |-
Token resource
---

# mapbox_token (Resource)

Token resource

## Example Usage

```terraform
resource "mapbox_token" "example" {
configurable_attribute = "some-value"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `allowed_urls` (Set of String) URLs that this token is allowed to work with.
- `note` (String) A description for the token.
- `scopes` (Set of String) Specify the scopes that the new token will have. The authorizing token needs to have the same scopes as, or more scopes than, the new token you are creating.
- `username` (String) The username of the account for which to list scopes.

### Read-Only

- `id` (String) Token identifier
- `token` (String, Sensitive) Token value
14 changes: 8 additions & 6 deletions internal/provider/mapbox_token_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,25 @@ package provider

import (
"fmt"
"os"
"testing"

"github.com/hashicorp/terraform-plugin-testing/helper/resource"
)

func TestAccTokenResource(t *testing.T) {
resourceName := "mapbox_token.test"
name := os.Getenv("MAPBOX_USERNAME")
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
Steps: []resource.TestStep{
// Create and Read testing
{
Config: testAccTokenResourceConfig("devops-placer", "https://docs.mapbox.com"),
Config: testAccTokenResourceConfig(name, "https://docs.mapbox.com"),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr(resourceName, "username", "devops-placer"),
resource.TestCheckResourceAttr(resourceName, "note", "devops-placer"),
resource.TestCheckResourceAttr(resourceName, "username", name),
resource.TestCheckResourceAttr(resourceName, "note", name),
resource.TestCheckResourceAttr(resourceName, "scopes.#", "2"),
resource.TestCheckTypeSetElemAttr(resourceName, "scopes.*", "fonts:read"),
resource.TestCheckTypeSetElemAttr(resourceName, "scopes.*", "styles:read"),
Expand All @@ -38,10 +40,10 @@ func TestAccTokenResource(t *testing.T) {
},
// Update and Read testing
{
Config: testAccTokenResourceConfig("devops-placer", "https://docs.mapbox1.com"),
Config: testAccTokenResourceConfig(name, "https://docs.mapbox1.com"),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr(resourceName, "username", "devops-placer"),
resource.TestCheckResourceAttr(resourceName, "note", "devops-placer"),
resource.TestCheckResourceAttr(resourceName, "username", name),
resource.TestCheckResourceAttr(resourceName, "note", name),
resource.TestCheckResourceAttr(resourceName, "scopes.#", "2"),
resource.TestCheckTypeSetElemAttr(resourceName, "scopes.*", "fonts:read"),
resource.TestCheckTypeSetElemAttr(resourceName, "scopes.*", "styles:read"),
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func main() {
flag.Parse()

opts := providerserver.ServeOpts{
Address: "DrFaust92/mapbox",
Address: "registry.terraform.io/DrFaust92/mapbox",
Debug: debug,
}

Expand Down

0 comments on commit 83bc6e7

Please sign in to comment.