Skip to content

Commit

Permalink
Change module name to terraform-provider-qubitpi
Browse files Browse the repository at this point in the history
  • Loading branch information
QubitPi committed Oct 6, 2024
1 parent 1f556c9 commit f64005f
Show file tree
Hide file tree
Showing 18 changed files with 69 additions and 100 deletions.
27 changes: 20 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,32 @@
# Terraform Provider release workflow.
name: Release

# This GitHub action creates a release when a tag that matches the pattern
# "v*" (e.g. v0.1.0) is created.
on:
push:
tags:
- 'v*'
workflow_call:

# Releases need permissions to read and write the repository contents.
# GitHub considers creating releases and uploading assets as writing contents.
permissions:
contents: write
packages: read

jobs:
push-release-tag:
uses: QubitPi/hashistack/.github/workflows/version-bump.yml@master
with:
user: QubitPi
email: [email protected]

get-go-version:
runs-on: ubuntu-latest
outputs:
go-version: ${{ steps.get-go-version.outputs.go-version }}
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: 'Determine Go version'
id: get-go-version
run: |
echo "Found Go $(cat .go-version)"
echo "go-version=$(cat .go-version)" >> $GITHUB_OUTPUT
goreleaser:
runs-on: ubuntu-latest
steps:
Expand Down
17 changes: 5 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
# Terraform Provider testing workflow.
# Copyright Jiaqi Liu
---
name: Tests

# This GitHub action runs your tests for each pull request and push.
# Optionally, you can turn it on using a schedule for regular testing.
on:
"on":
pull_request:
paths-ignore:
- 'README.md'
push:
paths-ignore:
- 'README.md'

# Testing only needs permissions to read the repository contents.
permissions:
contents: read
branches:
- master

jobs:
# Ensure project builds before running testing matrix
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Terraform Provider Scaffolding (Terraform Plugin Framework)
Qubit Terraform Provider Plugin
===============================

_This template repository is built on the [Terraform Plugin Framework](https://github.com/hashicorp/terraform-plugin-framework). The template repository built on the [Terraform Plugin SDK](https://github.com/hashicorp/terraform-plugin-sdk) can be found at [terraform-provider-scaffolding](https://github.com/hashicorp/terraform-provider-scaffolding). See [Which SDK Should I Use?](https://developer.hashicorp.com/terraform/plugin/framework-benefits) in the Terraform documentation for additional information._

Expand Down
10 changes: 2 additions & 8 deletions docs/data-sources/example.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "scaffolding_example Data Source - scaffolding"
page_title: "qubitpi_example Data Source - qubitpi"
subcategory: ""
description: |-
Example data source
---

# scaffolding_example (Data Source)
# qubitpi_example (Data Source)

Example data source

## Example Usage

```terraform
data "scaffolding_example" "example" {
configurable_attribute = "some-value"
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
26 changes: 0 additions & 26 deletions docs/functions/example.md

This file was deleted.

6 changes: 3 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "scaffolding Provider"
page_title: "qubitpi Provider"
subcategory: ""
description: |-
---

# scaffolding Provider
# qubitpi Provider



## Example Usage

```terraform
provider "scaffolding" {
provider "qubitpi" {
# example configuration here
}
```
Expand Down
10 changes: 2 additions & 8 deletions docs/resources/example.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "scaffolding_example Resource - scaffolding"
page_title: "qubitpi_example Resource - qubitpi"
subcategory: ""
description: |-
Example resource
---

# scaffolding_example (Resource)
# qubitpi_example (Resource)

Example resource

## Example Usage

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

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
2 changes: 1 addition & 1 deletion examples/data-sources/scaffolding_example/data-source.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
data "scaffolding_example" "example" {
data "qubitpi_example" "example" {
configurable_attribute = "some-value"
}
2 changes: 1 addition & 1 deletion examples/provider/provider.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
provider "scaffolding" {
provider "qubitpi" {
# example configuration here
}
2 changes: 1 addition & 1 deletion examples/resources/scaffolding_example/resource.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
resource "scaffolding_example" "example" {
resource "qubitpi_example" "example" {
configurable_attribute = "some-value"
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/hashicorp/terraform-provider-scaffolding-framework
module terraform-provider-qubitpi

go 1.22.7

Expand Down
4 changes: 2 additions & 2 deletions internal/provider/example_data_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ func TestAccExampleDataSource(t *testing.T) {
{
Config: testAccExampleDataSourceConfig,
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("data.scaffolding_example.test", "id", "example-id"),
resource.TestCheckResourceAttr("data.qubitpi_example.test", "id", "example-id"),
),
},
},
})
}

const testAccExampleDataSourceConfig = `
data "scaffolding_example" "test" {
data "qubitpi_example" "test" {
configurable_attribute = "example"
}
`
6 changes: 3 additions & 3 deletions internal/provider/example_function_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestExampleFunction_Known(t *testing.T) {
{
Config: `
output "test" {
value = provider::scaffolding::example("testvalue")
value = provider::qubitpi::example("testvalue")
}
`,
Check: resource.ComposeAggregateTestCheckFunc(
Expand All @@ -42,7 +42,7 @@ func TestExampleFunction_Null(t *testing.T) {
{
Config: `
output "test" {
value = provider::scaffolding::example(null)
value = provider::qubitpi::example(null)
}
`,
// The parameter does not enable AllowNullValue
Expand All @@ -66,7 +66,7 @@ func TestExampleFunction_Unknown(t *testing.T) {
}
output "test" {
value = provider::scaffolding::example(terraform_data.test.output)
value = provider::qubitpi::example(terraform_data.test.output)
}
`,
Check: resource.ComposeAggregateTestCheckFunc(
Expand Down
12 changes: 6 additions & 6 deletions internal/provider/example_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ func TestAccExampleResource(t *testing.T) {
{
Config: testAccExampleResourceConfig("one"),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("scaffolding_example.test", "configurable_attribute", "one"),
resource.TestCheckResourceAttr("scaffolding_example.test", "defaulted", "example value when not configured"),
resource.TestCheckResourceAttr("scaffolding_example.test", "id", "example-id"),
resource.TestCheckResourceAttr("qubitpi_example.test", "configurable_attribute", "one"),
resource.TestCheckResourceAttr("qubitpi_example.test", "defaulted", "example value when not configured"),
resource.TestCheckResourceAttr("qubitpi_example.test", "id", "example-id"),
),
},
// ImportState testing
{
ResourceName: "scaffolding_example.test",
ResourceName: "qubitpi_example.test",
ImportState: true,
ImportStateVerify: true,
// This is not normally necessary, but is here because this
Expand All @@ -39,7 +39,7 @@ func TestAccExampleResource(t *testing.T) {
{
Config: testAccExampleResourceConfig("two"),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("scaffolding_example.test", "configurable_attribute", "two"),
resource.TestCheckResourceAttr("qubitpi_example.test", "configurable_attribute", "two"),
),
},
// Delete testing automatically occurs in TestCase
Expand All @@ -49,7 +49,7 @@ func TestAccExampleResource(t *testing.T) {

func testAccExampleResourceConfig(configurableAttribute string) string {
return fmt.Sprintf(`
resource "scaffolding_example" "test" {
resource "qubitpi_example" "test" {
configurable_attribute = %[1]q
}
`, configurableAttribute)
Expand Down
32 changes: 16 additions & 16 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,29 @@ import (
"github.com/hashicorp/terraform-plugin-framework/types"
)

// Ensure ScaffoldingProvider satisfies various provider interfaces.
var _ provider.Provider = &ScaffoldingProvider{}
var _ provider.ProviderWithFunctions = &ScaffoldingProvider{}
// Ensure QubitPiProvider satisfies various provider interfaces.
var _ provider.Provider = &QubitPiProvider{}
var _ provider.ProviderWithFunctions = &QubitPiProvider{}

// ScaffoldingProvider defines the provider implementation.
type ScaffoldingProvider struct {
// QubitPiProvider defines the provider implementation.
type QubitPiProvider struct {
// version is set to the provider version on release, "dev" when the
// provider is built and ran locally, and "test" when running acceptance
// testing.
version string
}

// ScaffoldingProviderModel describes the provider data model.
type ScaffoldingProviderModel struct {
// QubitPiProviderModel describes the provider data model.
type QubitPiProviderModel struct {
Endpoint types.String `tfsdk:"endpoint"`
}

func (p *ScaffoldingProvider) Metadata(ctx context.Context, req provider.MetadataRequest, resp *provider.MetadataResponse) {
resp.TypeName = "scaffolding"
func (p *QubitPiProvider) Metadata(ctx context.Context, req provider.MetadataRequest, resp *provider.MetadataResponse) {
resp.TypeName = "qubitpi"
resp.Version = p.version
}

func (p *ScaffoldingProvider) Schema(ctx context.Context, req provider.SchemaRequest, resp *provider.SchemaResponse) {
func (p *QubitPiProvider) Schema(ctx context.Context, req provider.SchemaRequest, resp *provider.SchemaResponse) {
resp.Schema = schema.Schema{
Attributes: map[string]schema.Attribute{
"endpoint": schema.StringAttribute{
Expand All @@ -48,8 +48,8 @@ func (p *ScaffoldingProvider) Schema(ctx context.Context, req provider.SchemaReq
}
}

func (p *ScaffoldingProvider) Configure(ctx context.Context, req provider.ConfigureRequest, resp *provider.ConfigureResponse) {
var data ScaffoldingProviderModel
func (p *QubitPiProvider) Configure(ctx context.Context, req provider.ConfigureRequest, resp *provider.ConfigureResponse) {
var data QubitPiProviderModel

resp.Diagnostics.Append(req.Config.Get(ctx, &data)...)

Expand All @@ -66,27 +66,27 @@ func (p *ScaffoldingProvider) Configure(ctx context.Context, req provider.Config
resp.ResourceData = client
}

func (p *ScaffoldingProvider) Resources(ctx context.Context) []func() resource.Resource {
func (p *QubitPiProvider) Resources(ctx context.Context) []func() resource.Resource {
return []func() resource.Resource{
NewExampleResource,
}
}

func (p *ScaffoldingProvider) DataSources(ctx context.Context) []func() datasource.DataSource {
func (p *QubitPiProvider) DataSources(ctx context.Context) []func() datasource.DataSource {
return []func() datasource.DataSource{
NewExampleDataSource,
}
}

func (p *ScaffoldingProvider) Functions(ctx context.Context) []func() function.Function {
func (p *QubitPiProvider) Functions(ctx context.Context) []func() function.Function {
return []func() function.Function{
NewExampleFunction,
}
}

func New(version string) func() provider.Provider {
return func() provider.Provider {
return &ScaffoldingProvider{
return &QubitPiProvider{
version: version,
}
}
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
// CLI command executed to create a provider server to which the CLI can
// reattach.
var testAccProtoV6ProviderFactories = map[string]func() (tfprotov6.ProviderServer, error){
"scaffolding": providerserver.NewProtocol6WithError(New("test")()),
"qubitpi": providerserver.NewProtocol6WithError(New("test")()),
}

func testAccPreCheck(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"context"
"flag"
"log"
"terraform-provider-qubitpi/internal/provider"

"github.com/hashicorp/terraform-plugin-framework/providerserver"
"github.com/hashicorp/terraform-provider-scaffolding-framework/internal/provider"
)

var (
Expand All @@ -31,7 +31,7 @@ func main() {
// TODO: Update this string with the published name of your provider.
// Also update the tfplugindocs generate command to either remove the
// -provider-name flag or set its value to the updated provider name.
Address: "registry.terraform.io/hashicorp/scaffolding",
Address: "registry.terraform.io/hashicorp/qubitpi",
Debug: debug,
}

Expand Down
2 changes: 1 addition & 1 deletion tools/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ import (
//go:generate terraform fmt -recursive ../examples/

// Generate documentation.
//go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs generate --provider-dir .. -provider-name scaffolding
//go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs generate --provider-dir .. -provider-name qubitpi

0 comments on commit f64005f

Please sign in to comment.