Skip to content

Commit 8545f6e

Browse files
authored
Merge pull request #30 from aep-dev/test2
Add config values
2 parents 24fd33e + 7491b16 commit 8545f6e

22 files changed

Lines changed: 102 additions & 1163 deletions

.copywrite.hcl

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,6 @@ jobs:
3434
with:
3535
version: latest
3636

37-
generate:
38-
runs-on: ubuntu-latest
39-
steps:
40-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
41-
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
42-
with:
43-
go-version-file: 'go.mod'
44-
cache: true
45-
# We need the latest version of Terraform for our documentation generation to use
46-
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
47-
with:
48-
terraform_wrapper: false
49-
- run: make generate
50-
- name: git diff
51-
run: |
52-
git diff --compact-summary --exit-code || \
53-
(echo; echo "Unexpected difference in directories after code generation. Run 'make generate' command and commit."; exit 1)
54-
5537
# Run acceptance tests in a matrix with Terraform CLI versions
5638
test:
5739
name: Terraform Provider Acceptance Tests

GNUmakefile

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
default: fmt lint install generate
1+
default: fmt lint install
22

33
build:
44
go build -v ./...
@@ -9,9 +9,6 @@ install: build
99
lint:
1010
golangci-lint run
1111

12-
generate:
13-
cd tools; go generate ./...
14-
1512
fmt:
1613
gofmt -s -w -e .
1714

@@ -21,4 +18,4 @@ test:
2118
testacc:
2219
TF_ACC=1 go test -v -cover -timeout 120m ./...
2320

24-
.PHONY: fmt lint test testacc build install generate
21+
.PHONY: fmt lint test testacc build install

docs/data-sources/example.md

Lines changed: 0 additions & 30 deletions
This file was deleted.

docs/functions/example.md

Lines changed: 0 additions & 26 deletions
This file was deleted.

docs/index.md

Lines changed: 0 additions & 26 deletions
This file was deleted.

docs/resources/example.md

Lines changed: 0 additions & 31 deletions
This file was deleted.

internal/provider/config.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package provider
2+
3+
// Only change these values.
4+
5+
// The URI where your OpenAPI spec lives.
6+
const OpenAPIPath = "http://localhost:8081/openapi.json"
7+
8+
// The name of your provider.
9+
// All resources will have the prefix `prefix_resource`.
10+
const ProviderPrefix = "scaffolding"
11+
12+
// Do not change anything below here!
13+
14+
type ProviderConfig struct {
15+
ProviderPrefix string
16+
OpenAPIPath string
17+
}
18+
19+
func NewProviderConfig() ProviderConfig {
20+
return ProviderConfig{
21+
ProviderPrefix: ProviderPrefix,
22+
OpenAPIPath: OpenAPIPath,
23+
}
24+
}

internal/provider/data/ptr.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package data
22

33
import "math/big"
44

5-
// Helper functions for creating pointers
5+
// Helper functions for creating pointers.
66
func String(v string) *string {
77
return &v
88
}

internal/provider/data/resource.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,11 @@ func (r *Resource) FromTerraform5Value(value tftypes.Value) error {
8282
// We know these kinds of conversions are safe now, as we checked the type
8383
// at the beginning.
8484
r.Values = *values.Object
85-
r.objectType = value.Type().(tftypes.Object)
85+
v, ok := value.Type().(tftypes.Object)
86+
if !ok {
87+
return fmt.Errorf("value %v is not a object", value.Type())
88+
}
89+
r.objectType = v
8690
return nil
8791
}
8892

0 commit comments

Comments
 (0)