Skip to content

Commit cc94d4a

Browse files
committed
handle plugins
Signed-off-by: sivchari <shibuuuu5@gmail.com>
1 parent 03cdf91 commit cc94d4a

16 files changed

Lines changed: 751 additions & 229 deletions

.github/workflows/lint-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
go-version: 'stable'
2121
cache: true
2222
- name: Install golangci-lint
23-
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
23+
run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
2424
- name: Run golangci-lint
2525
run: golangci-lint run ./...
2626
test:

.golangci.yml

Lines changed: 53 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,68 @@
1-
run:
2-
timeout: 5m
3-
4-
linters-settings:
5-
govet:
6-
enable-all: true
7-
disable:
8-
- shadow
9-
misspell:
10-
locale: US
11-
lll:
12-
line-length: 160
13-
revive:
14-
rules:
15-
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#var-naming
16-
- name: var-naming
17-
forbidigo:
18-
forbid:
19-
- t\.Fatal.*
20-
- fmt\.Print.*
21-
1+
version: "2"
222
linters:
23-
disable-all: true
3+
default: none
244
enable:
25-
# Errcheck is a program for checking for unchecked errors in go programs.
26-
# These unchecked errors can be critical bugs in some cases
27-
- errcheck
28-
# Linter for Go source code that specializes in simplifying a code
29-
- gosimple
30-
# Vet examines Go source code and reports suspicious constructs,
31-
# such as Printf calls whose arguments do not align with the format string
32-
- govet
33-
# Forbids identifiers
34-
- forbidigo
35-
# Staticcheck is a go vet on steroids, applying a ton of static analysis checks
36-
- staticcheck
37-
# Like the front-end of a Go compiler, parses and type-checks Go code
38-
- typecheck
39-
# Checks Go code for unused constants, variables, functions and types
40-
- unused
41-
# checks whether HTTP response body is closed successfully
425
- bodyclose
43-
# containedctx is a linter that detects struct contained context.Context field
446
- containedctx
45-
# Checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error.
46-
- errname
47-
# A linter detects places where loop variables are copied.
487
- copyloopvar
49-
# Gofumpt checks whether code was gofumpt-ed.
50-
- gofumpt
51-
# Reports long lines
8+
- errcheck
9+
- errname
10+
- forbidigo
11+
- govet
5212
- lll
53-
# Finds commonly misspelled English words in comments
5413
- misspell
55-
# Finds naked returns in functions greater than a specified function length
5614
- nakedret
57-
# paralleltest detects missing usage of t.Parallel() method in your Go test
5815
- paralleltest
59-
# Finds slice declarations that could potentially be pre-allocated
6016
- prealloc
61-
# find code that shadows one of Go's predeclared identifiers
6217
- predeclared
63-
# Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint
6418
- revive
65-
# Stylecheck is a replacement for golint
66-
- stylecheck
67-
# Reports uses of functions with replacement inside the testing package.
19+
- staticcheck
20+
- unused
6821
- usetesting
69-
22+
settings:
23+
forbidigo:
24+
forbid:
25+
- pattern: t\.Fatal.*
26+
- pattern: fmt\.Print.*
27+
govet:
28+
disable:
29+
- shadow
30+
enable-all: true
31+
lll:
32+
line-length: 165
33+
misspell:
34+
locale: US
35+
revive:
36+
rules:
37+
- name: var-naming
38+
exclusions:
39+
generated: lax
40+
presets:
41+
- comments
42+
- common-false-positives
43+
- legacy
44+
- std-error-handling
45+
rules:
46+
- linters:
47+
- govet
48+
path: \.go
49+
text: 'fieldalignment:'
50+
- linters:
51+
- staticcheck
52+
path: \.go
53+
text: 'SA1019'
54+
paths:
55+
- third_party$
56+
- builtin$
57+
- examples$
7058
issues:
71-
exclude-use-default: true
72-
max-per-linter: 0
7359
max-same-issues: 0
74-
exclude: []
75-
exclude-rules:
76-
# All
77-
- path: \.go
78-
text: "fieldalignment:"
79-
linters:
80-
- govet
60+
formatters:
61+
enable:
62+
- gofumpt
63+
exclusions:
64+
generated: lax
65+
paths:
66+
- third_party$
67+
- builtin$
68+
- examples$

docs/data-sources/application.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ PipeCD application resource.
2626
- `kind` (String) The kind of application.
2727
- `name` (String) The application name.
2828
- `piped_id` (String) The ID of piped that should handle this application.
29-
- `platform_provider` (String) The platform provider name. One of the registered providers in the piped configuration. The previous name of this field is cloud-provider.
29+
- `platform_provider` (String, Deprecated) The platform provider name. One of the registered providers in the piped configuration. The previous name of this field is cloud-provider.
30+
- `plugins` (Attributes List) The list of plugins that this application uses. (see [below for nested schema](#nestedatt--plugins))
3031
- `project_id` (String)
3132

3233
<a id="nestedatt--git"></a>
@@ -39,3 +40,12 @@ Read-Only:
3940
- `path` (String) The relative path from the root of repository to the application directory.
4041
- `remote` (String)
4142
- `repository_id` (String) The repository ID. One the registered repositories in the piped configuration.
43+
44+
45+
<a id="nestedatt--plugins"></a>
46+
### Nested Schema for `plugins`
47+
48+
Read-Only:
49+
50+
- `deploy_targets` (List of String) The list of deploy targets that this plugin uses.
51+
- `name` (String) The name of the plugin.

docs/data-sources/piped.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ PipeCD pied data source.
2020
- `description` (String)
2121
- `id` (String) The ID of this resource.
2222
- `name` (String)
23-
- `platform_providers` (Attributes List) (see [below for nested schema](#nestedatt--platform_providers))
23+
- `platform_providers` (Attributes List, Deprecated) (see [below for nested schema](#nestedatt--platform_providers))
24+
- `plugins` (Attributes List) The list of plugins that this piped uses. (see [below for nested schema](#nestedatt--plugins))
2425
- `project_id` (String)
2526
- `repositories` (Attributes List) (see [below for nested schema](#nestedatt--repositories))
2627

@@ -33,6 +34,15 @@ Read-Only:
3334
- `type` (String)
3435

3536

37+
<a id="nestedatt--plugins"></a>
38+
### Nested Schema for `plugins`
39+
40+
Read-Only:
41+
42+
- `deploy_targets` (List of String) The list of deploy targets that this plugin uses.
43+
- `name` (String) The name of the plugin.
44+
45+
3646
<a id="nestedatt--repositories"></a>
3747
### Nested Schema for `repositories`
3848

docs/resources/application.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@ PipeCD application resource.
2121
- `kind` (String) The kind of application.
2222
- `name` (String) The application name.
2323
- `piped_id` (String) The ID of piped that should handle this application.
24-
- `platform_provider` (String) The platform provider name. One of the registered providers in the piped configuration. The previous name of this field is cloud-provider.
2524

2625
### Optional
2726

2827
- `description` (String) The description of the application.
28+
- `platform_provider` (String, Deprecated) The platform provider name. One of the registered providers in the piped configuration. The previous name of this field is cloud-provider.
29+
- `plugins` (Attributes List) The list of plugins that this application uses. (see [below for nested schema](#nestedatt--plugins))
2930

3031
### Read-Only
3132

@@ -41,6 +42,13 @@ Required:
4142

4243
Optional:
4344

44-
- `branch` (String)
4545
- `filename` (String) The configuration file name. (default "app.pipecd.yaml")
46-
- `remote` (String)
46+
47+
48+
<a id="nestedatt--plugins"></a>
49+
### Nested Schema for `plugins`
50+
51+
Required:
52+
53+
- `deploy_targets` (List of String) The list of deploy targets that this plugin uses.
54+
- `name` (String) The name of the plugin.

docs/resources/piped.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ PipeCD piped resource.
2525

2626
### Read-Only
2727

28-
- `api_key` (String) The API key of the piped.
28+
- `api_key` (String, Sensitive) The API key of the piped.
2929
- `id` (String) The ID of piped that should handle this application.

go.mod

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
module github.com/pipe-cd/terraform-provider-pipecd
22

3-
go 1.23.0
4-
5-
toolchain go1.24.1
3+
go 1.24.1
64

75
require (
8-
github.com/golang/mock v1.6.0
96
github.com/hashicorp/terraform-plugin-docs v0.21.0
107
github.com/hashicorp/terraform-plugin-framework v1.14.1
118
github.com/hashicorp/terraform-plugin-framework-validators v0.17.0
129
github.com/hashicorp/terraform-plugin-go v0.26.0
1310
github.com/hashicorp/terraform-plugin-log v0.9.0
1411
github.com/hashicorp/terraform-plugin-testing v1.12.0
15-
github.com/pipe-cd/pipecd v0.50.2
12+
github.com/pipe-cd/pipecd v0.51.2
13+
go.uber.org/mock v0.5.0
1614
google.golang.org/grpc v1.72.0
1715
)
1816

@@ -32,8 +30,8 @@ require (
3230
github.com/coreos/go-oidc/v3 v3.11.0 // indirect
3331
github.com/envoyproxy/protoc-gen-validate v1.2.1 // indirect
3432
github.com/fatih/color v1.16.0 // indirect
35-
github.com/go-jose/go-jose/v4 v4.0.4 // indirect
36-
github.com/golang-jwt/jwt v3.2.1+incompatible // indirect
33+
github.com/go-jose/go-jose/v4 v4.0.5 // indirect
34+
github.com/golang-jwt/jwt/v5 v5.2.2 // indirect
3735
github.com/golang/protobuf v1.5.4 // indirect
3836
github.com/google/go-cmp v0.7.0 // indirect
3937
github.com/google/uuid v1.6.0 // indirect
@@ -78,13 +76,13 @@ require (
7876
github.com/yuin/goldmark-meta v1.1.0 // indirect
7977
github.com/zclconf/go-cty v1.16.2 // indirect
8078
go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect
81-
go.uber.org/atomic v1.7.0 // indirect
82-
go.uber.org/multierr v1.2.0 // indirect
83-
go.uber.org/zap v1.10.1-0.20190709142728-9a9fa7d4b5f0 // indirect
79+
go.uber.org/atomic v1.11.0 // indirect
80+
go.uber.org/multierr v1.6.0 // indirect
81+
go.uber.org/zap v1.19.1 // indirect
8482
golang.org/x/crypto v0.36.0 // indirect
8583
golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 // indirect
8684
golang.org/x/mod v0.22.0 // indirect
87-
golang.org/x/net v0.37.0 // indirect
85+
golang.org/x/net v0.38.0 // indirect
8886
golang.org/x/oauth2 v0.26.0 // indirect
8987
golang.org/x/sync v0.12.0 // indirect
9088
golang.org/x/sys v0.31.0 // indirect

0 commit comments

Comments
 (0)