Skip to content

Commit df12f5f

Browse files
rchamarthyDodinViorelkprav33nlelia
authored
import from private repo (#5)
* Add terraform framework and configure golangci-linter * Add OAuth support, configure provider, add GET for type data source * Add object API and object resource on COP provider * Add support for Service Principal authentication method * Unify makefiles * Fix issues identified by the linter * Configure GoReleaser * chore: add MPL License Signed-off-by: Ravi Chamarthy <ravi@chamarthy.dev> * Update goreleaser workflow in accordanc with latest Hashicorp guidance Signed-off-by: lelia <le1ia@me.com> --------- Signed-off-by: Ravi Chamarthy <ravi@chamarthy.dev> Signed-off-by: lelia <le1ia@me.com> Co-authored-by: DodinViorel <dodinviorel@gmail.com> Co-authored-by: Praveen Kumar <praveek6@cisco.com> Co-authored-by: lelia <le1ia@me.com>
1 parent 65238f5 commit df12f5f

40 files changed

+2770
-344
lines changed

.github/dependabot.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,8 @@
1-
# Copyright 2024 Cisco Systems, Inc. and its affiliates
1+
# This Source Code Form is subject to the terms of the Mozilla Public
2+
# License, v. 2.0. If a copy of the MPL was not distributed with this
3+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
24
#
3-
# Licensed under the Apache License, Version 2.0 (the "License");
4-
# you may not use this file except in compliance with the License.
5-
# You may obtain a copy of the License at
6-
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
9-
# Unless required by applicable law or agreed to in writing, software
10-
# distributed under the License is distributed on an "AS IS" BASIS,
11-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
# See the License for the specific language governing permissions and
13-
# limitations under the License.
14-
#
15-
# SPDX-License-Identifier: Apache-2.0
5+
# SPDX-License-Identifier: MPL-2.0
166

177
version: 2
188
updates:

.github/workflows/dependency-review.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,8 @@
1-
# Copyright 2024 Cisco Systems, Inc. and its affiliates
1+
# This Source Code Form is subject to the terms of the Mozilla Public
2+
# License, v. 2.0. If a copy of the MPL was not distributed with this
3+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
24
#
3-
# Licensed under the Apache License, Version 2.0 (the "License");
4-
# you may not use this file except in compliance with the License.
5-
# You may obtain a copy of the License at
6-
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
9-
# Unless required by applicable law or agreed to in writing, software
10-
# distributed under the License is distributed on an "AS IS" BASIS,
11-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
# See the License for the specific language governing permissions and
13-
# limitations under the License.
14-
#
15-
# SPDX-License-Identifier: Apache-2.0
5+
# SPDX-License-Identifier: MPL-2.0
166

177
# Dependency Review Action
188
#

.github/workflows/license.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,8 @@
1-
# Copyright 2024 Cisco Systems, Inc. and its affiliates
1+
# This Source Code Form is subject to the terms of the Mozilla Public
2+
# License, v. 2.0. If a copy of the MPL was not distributed with this
3+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
24
#
3-
# Licensed under the Apache License, Version 2.0 (the "License");
4-
# you may not use this file except in compliance with the License.
5-
# You may obtain a copy of the License at
6-
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
9-
# Unless required by applicable law or agreed to in writing, software
10-
# distributed under the License is distributed on an "AS IS" BASIS,
11-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
# See the License for the specific language governing permissions and
13-
# limitations under the License.
14-
#
15-
# SPDX-License-Identifier: Apache-2.0
5+
# SPDX-License-Identifier: MPL-2.0
166

177
name: license-check
188

.github/workflows/lint.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,8 @@
1-
# Copyright 2024 Cisco Systems, Inc. and its affiliates
1+
# This Source Code Form is subject to the terms of the Mozilla Public
2+
# License, v. 2.0. If a copy of the MPL was not distributed with this
3+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
24
#
3-
# Licensed under the Apache License, Version 2.0 (the "License");
4-
# you may not use this file except in compliance with the License.
5-
# You may obtain a copy of the License at
6-
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
9-
# Unless required by applicable law or agreed to in writing, software
10-
# distributed under the License is distributed on an "AS IS" BASIS,
11-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
# See the License for the specific language governing permissions and
13-
# limitations under the License.
14-
#
15-
# SPDX-License-Identifier: Apache-2.0
5+
# SPDX-License-Identifier: MPL-2.0
166

177
name: lint
188

.github/workflows/markdown.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,8 @@
1-
# Copyright 2024 Cisco Systems, Inc. and its affiliates
1+
# This Source Code Form is subject to the terms of the Mozilla Public
2+
# License, v. 2.0. If a copy of the MPL was not distributed with this
3+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
24
#
3-
# Licensed under the Apache License, Version 2.0 (the "License");
4-
# you may not use this file except in compliance with the License.
5-
# You may obtain a copy of the License at
6-
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
9-
# Unless required by applicable law or agreed to in writing, software
10-
# distributed under the License is distributed on an "AS IS" BASIS,
11-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
# See the License for the specific language governing permissions and
13-
# limitations under the License.
14-
#
15-
# SPDX-License-Identifier: Apache-2.0
5+
# SPDX-License-Identifier: MPL-2.0
166

177
name: markdown-lint
188

.github/workflows/release.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# This Source Code Form is subject to the terms of the Mozilla Public
2+
# License, v. 2.0. If a copy of the MPL was not distributed with this
3+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
4+
#
5+
# SPDX-License-Identifier: MPL-2.0
6+
7+
# Terraform Provider release workflow
8+
name: release
9+
10+
# This GitHub action creates a release when a tag that matches the pattern
11+
# "v*" (e.g. v0.1.0) is created
12+
on:
13+
push:
14+
tags:
15+
- "v*"
16+
17+
# Set top-level permissions to read-only
18+
permissions:
19+
contents: read
20+
21+
jobs:
22+
goreleaser:
23+
runs-on: ubuntu-latest
24+
# Releases need permissions to read and write the repository contents
25+
permissions:
26+
contents: write
27+
steps:
28+
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
29+
with:
30+
# Allow goreleaser to access older tag information
31+
fetch-depth: 0
32+
- name: 📦 setup go
33+
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
34+
with:
35+
go-version-file: "go.mod"
36+
cache: true
37+
- name: 🔑 import GPG key
38+
id: gpg-key
39+
uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # v6.1.0
40+
with:
41+
gpg_private_key: ${{ secrets.TERRAFORM_GPG_PRIVATE_KEY }}
42+
passphrase: ${{ secrets.TERRAFORM_GPG_PASSPHRASE }}
43+
- name: 🚀 run goreleaser
44+
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
45+
with:
46+
args: release --clean
47+
env:
48+
# GitHub sets the GITHUB_TOKEN secret automatically
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
GPG_FINGERPRINT: ${{ steps.gpg-key.outputs.fingerprint }}

.github/workflows/scorecard.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,8 @@
1-
# Copyright 2024 Cisco Systems, Inc. and its affiliates
1+
# This Source Code Form is subject to the terms of the Mozilla Public
2+
# License, v. 2.0. If a copy of the MPL was not distributed with this
3+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
24
#
3-
# Licensed under the Apache License, Version 2.0 (the "License");
4-
# you may not use this file except in compliance with the License.
5-
# You may obtain a copy of the License at
6-
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
9-
# Unless required by applicable law or agreed to in writing, software
10-
# distributed under the License is distributed on an "AS IS" BASIS,
11-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
# See the License for the specific language governing permissions and
13-
# limitations under the License.
14-
#
15-
# SPDX-License-Identifier: Apache-2.0
5+
# SPDX-License-Identifier: MPL-2.0
166

177
name: scorecard
188

.github/workflows/stale.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,8 @@
1-
# Copyright 2024 Cisco Systems, Inc. and its affiliates
1+
# This Source Code Form is subject to the terms of the Mozilla Public
2+
# License, v. 2.0. If a copy of the MPL was not distributed with this
3+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
24
#
3-
# Licensed under the Apache License, Version 2.0 (the "License");
4-
# you may not use this file except in compliance with the License.
5-
# You may obtain a copy of the License at
6-
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
9-
# Unless required by applicable law or agreed to in writing, software
10-
# distributed under the License is distributed on an "AS IS" BASIS,
11-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
# See the License for the specific language governing permissions and
13-
# limitations under the License.
14-
#
15-
# SPDX-License-Identifier: Apache-2.0
5+
# SPDX-License-Identifier: MPL-2.0
166

177
name: stale
188

.github/workflows/test.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,8 @@
1-
# Copyright 2024 Cisco Systems, Inc. and its affiliates
1+
# This Source Code Form is subject to the terms of the Mozilla Public
2+
# License, v. 2.0. If a copy of the MPL was not distributed with this
3+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
24
#
3-
# Licensed under the Apache License, Version 2.0 (the "License");
4-
# you may not use this file except in compliance with the License.
5-
# You may obtain a copy of the License at
6-
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
9-
# Unless required by applicable law or agreed to in writing, software
10-
# distributed under the License is distributed on an "AS IS" BASIS,
11-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
# See the License for the specific language governing permissions and
13-
# limitations under the License.
14-
#
15-
# SPDX-License-Identifier: Apache-2.0
5+
# SPDX-License-Identifier: MPL-2.0
166

177
name: test
188

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.tools
2+
terraform-provider-observability

.golangci.yml

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
# This Source Code Form is subject to the terms of the Mozilla Public
2+
# License, v. 2.0. If a copy of the MPL was not distributed with this
3+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
4+
#
5+
# SPDX-License-Identifier: MPL-2.0
6+
7+
linters-settings:
8+
depguard:
9+
rules:
10+
logger:
11+
deny:
12+
# logging is allowed only by logutils.Log,
13+
- pkg: "github.com/sirupsen/logrus"
14+
desc: logging is allowed only by logutils.Log.
15+
- pkg: "github.com/pkg/errors"
16+
desc: Should be replaced by standard lib errors package.
17+
- pkg: "github.com/instana/testify"
18+
desc: It's a fork of github.com/stretchr/testify.
19+
files:
20+
# logrus is allowed to use only in logutils package.
21+
- "!**/pkg/logutils/**.go"
22+
dupl:
23+
threshold: 100
24+
funlen:
25+
lines: -1 # the number of lines (code + empty lines) is not a right metric and leads to code without empty line or one-liner.
26+
statements: 50
27+
goconst:
28+
min-len: 2
29+
min-occurrences: 3
30+
gocritic:
31+
enabled-tags:
32+
- diagnostic
33+
- experimental
34+
- opinionated
35+
- performance
36+
- style
37+
disabled-checks:
38+
- dupImport # https://github.com/go-critic/go-critic/issues/845
39+
- ifElseChain
40+
- octalLiteral
41+
- whyNoLint
42+
gocyclo:
43+
min-complexity: 15
44+
godox:
45+
keywords:
46+
- FIXME
47+
gofmt:
48+
rewrite-rules:
49+
- pattern: 'interface{}'
50+
replacement: 'any'
51+
goimports:
52+
local-prefixes: github.com/golangci/golangci-lint
53+
gomnd:
54+
# don't include the "operation" and "assign"
55+
checks:
56+
- argument
57+
- case
58+
- condition
59+
- return
60+
ignored-numbers:
61+
- '0'
62+
- '1'
63+
- '2'
64+
- '3'
65+
ignored-functions:
66+
- strings.SplitN
67+
govet:
68+
settings:
69+
printf:
70+
funcs:
71+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
72+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
73+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
74+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
75+
enable:
76+
- nilness
77+
- shadow
78+
errorlint:
79+
asserts: false
80+
lll:
81+
line-length: 140
82+
misspell:
83+
locale: US
84+
ignore-words:
85+
- "importas" # linter name
86+
nolintlint:
87+
allow-unused: false # report any unused nolint directives
88+
require-explanation: true # require an explanation for nolint directives
89+
require-specific: true # require nolint directives to be specific about which linter is being skipped
90+
revive:
91+
rules:
92+
- name: unexported-return
93+
disabled: true
94+
- name: unused-parameter
95+
96+
linters:
97+
disable-all: true
98+
enable:
99+
- bodyclose
100+
- depguard
101+
- dogsled
102+
- dupl
103+
- errcheck
104+
- errorlint
105+
- exportloopref
106+
- funlen
107+
- gocheckcompilerdirectives
108+
- gochecknoinits
109+
- goconst
110+
- gocritic
111+
- gocyclo
112+
- godox
113+
- gofmt
114+
- goimports
115+
- gomnd
116+
- goprintffuncname
117+
- gosec
118+
- gosimple
119+
- govet
120+
- ineffassign
121+
- lll
122+
- misspell
123+
- nakedret
124+
- noctx
125+
- nolintlint
126+
- revive
127+
- staticcheck
128+
- stylecheck
129+
- unconvert
130+
- unparam
131+
- unused
132+
- whitespace
133+
134+
run:
135+
timeout: 5m
136+

0 commit comments

Comments
 (0)