Skip to content

Commit 3c90ff9

Browse files
ClaireBellivierClaire Bellivieroboukili
authored
Migrate to SDK V2 (argoproj-labs#62)
* fix: bumped terraform-json to 0.12, kind to 0.11.1, Go to 1.16, protobuf to 1.5.2, added argocd 2.1 and 2.0 to test suite * update to argocd 2.1.2, kube-api 0.21 Co-authored-by: Claire Bellivier <[email protected]> Co-authored-by: Olivier Boukili <[email protected]>
1 parent bbff05e commit 3c90ff9

39 files changed

+1443
-700
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Set up Go
1818
uses: actions/setup-go@v2
1919
with:
20-
go-version: 1.15
20+
go-version: 1.16
2121

2222
- name: Import GPG key
2323
id: import_gpg

.github/workflows/tests.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
argocd_version: ["v.1.8.3", "v1.7.11"]
17+
argocd_version: ["v2.1.2", "v2.0.5", "v.1.8.7"]
1818
steps:
1919
- uses: actions/checkout@v2
2020
- uses: actions/setup-go@v1
2121
with:
22-
go-version: 1.15
22+
go-version: 1.16
2323
id: go
2424
- name: Restore Go cache
2525
uses: actions/cache@v1
@@ -34,9 +34,9 @@ jobs:
3434
curl -sL "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
3535
chmod +x ./kustomize
3636
37-
- name: Install Kind 0.9.0
37+
- name: Install Kind 0.11.1
3838
run: |
39-
curl -sLo ./kind https://kind.sigs.k8s.io/dl/v0.9.0/kind-$(uname)-amd64
39+
curl -sLo ./kind https://kind.sigs.k8s.io/dl/v0.11.1/kind-$(uname)-amd64
4040
chmod +x ./kind
4141
4242
- name: Set up ArgoCD ${{ matrix.argocd_version }}

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
.idea
21
terraform-provider-argocd
32
./manifests/install/install.yml
3+
.idea
4+
.vscode
5+
# Env variables settings
6+
/scripts/testacc
7+
/scripts/testacc_prepare_env

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,8 @@ For example if you use Docker as your local container runtime:
365365
```shell
366366
docker pull argoproj/argocd:v1.8.3
367367
docker pull ghcr.io/dexidp/dex:v2.27.0
368-
docker pull redis:5.0.10-alpine
369-
docker pull banzaicloud/vault-operator:1.3.3
368+
docker pull redis:6.2.4-alpine
369+
docker pull bitnami/redis:6.2.5
370370
```
371371

372372
#### Troubleshooting during local development
@@ -380,4 +380,4 @@ docker pull banzaicloud/vault-operator:1.3.3
380380
* Thanks to [JetBrains](https://www.jetbrains.com/?from=terraform-provider-argocd) for providing a GoLand open source license to support the development of this provider.
381381
* Thanks to [Keplr](https://www.welcometothejungle.com/fr/companies/keplr) for allowing me to contribute to this side-project of mine during paid work hours.
382382

383-
![](sponsors/jetbrains.svg?display=inline-block) ![](sponsors/keplr.png?display=inline-block)
383+
![](sponsors/jetbrains.svg?display=inline-block) ![](sponsors/keplr.png?display=inline-block)

argocd/features.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ package argocd
33
import (
44
"fmt"
55
"github.com/Masterminds/semver"
6-
"github.com/argoproj/argo-cd/pkg/apiclient"
7-
"github.com/argoproj/argo-cd/pkg/apiclient/application"
8-
"github.com/argoproj/argo-cd/pkg/apiclient/cluster"
9-
"github.com/argoproj/argo-cd/pkg/apiclient/project"
10-
"github.com/argoproj/argo-cd/pkg/apiclient/repocreds"
11-
"github.com/argoproj/argo-cd/pkg/apiclient/repository"
12-
"github.com/argoproj/argo-cd/pkg/apiclient/version"
6+
"github.com/argoproj/argo-cd/v2/pkg/apiclient"
7+
"github.com/argoproj/argo-cd/v2/pkg/apiclient/application"
8+
"github.com/argoproj/argo-cd/v2/pkg/apiclient/cluster"
9+
"github.com/argoproj/argo-cd/v2/pkg/apiclient/project"
10+
"github.com/argoproj/argo-cd/v2/pkg/apiclient/repocreds"
11+
"github.com/argoproj/argo-cd/v2/pkg/apiclient/repository"
12+
"github.com/argoproj/argo-cd/v2/pkg/apiclient/version"
1313
)
1414

1515
const (

argocd/features_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package argocd
33
import (
44
"fmt"
55
"github.com/Masterminds/semver"
6-
"github.com/argoproj/argo-cd/pkg/apiclient/version"
6+
"github.com/argoproj/argo-cd/v2/pkg/apiclient/version"
77
"github.com/stretchr/testify/assert"
88
"math/rand"
99
"modernc.org/mathutil"

argocd/provider.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@ package argocd
33
import (
44
"context"
55
"fmt"
6+
"sync"
7+
68
"github.com/Masterminds/semver"
7-
"github.com/argoproj/argo-cd/pkg/apiclient"
8-
"github.com/argoproj/argo-cd/pkg/apiclient/application"
9-
"github.com/argoproj/argo-cd/pkg/apiclient/cluster"
10-
"github.com/argoproj/argo-cd/pkg/apiclient/project"
11-
"github.com/argoproj/argo-cd/pkg/apiclient/repocreds"
12-
"github.com/argoproj/argo-cd/pkg/apiclient/repository"
13-
"github.com/argoproj/argo-cd/pkg/apiclient/session"
14-
"github.com/argoproj/argo-cd/util/io"
9+
"github.com/argoproj/argo-cd/v2/pkg/apiclient"
10+
"github.com/argoproj/argo-cd/v2/pkg/apiclient/application"
11+
"github.com/argoproj/argo-cd/v2/pkg/apiclient/cluster"
12+
"github.com/argoproj/argo-cd/v2/pkg/apiclient/project"
13+
"github.com/argoproj/argo-cd/v2/pkg/apiclient/repocreds"
14+
"github.com/argoproj/argo-cd/v2/pkg/apiclient/repository"
15+
"github.com/argoproj/argo-cd/v2/pkg/apiclient/session"
16+
"github.com/argoproj/argo-cd/v2/util/io"
1517
"github.com/golang/protobuf/ptypes/empty"
16-
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
17-
"github.com/hashicorp/terraform-plugin-sdk/terraform"
18-
"sync"
18+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
1919
)
2020

2121
var apiClientConnOpts apiclient.ClientOptions
@@ -26,7 +26,7 @@ var tokenMutexConfiguration = &sync.RWMutex{}
2626
// Used to handle concurrent access to each ArgoCD project
2727
var tokenMutexProjectMap = make(map[string]*sync.RWMutex, 0)
2828

29-
func Provider() terraform.ResourceProvider {
29+
func Provider() *schema.Provider {
3030
return &schema.Provider{
3131
Schema: map[string]*schema.Schema{
3232
"server_addr": {

argocd/provider_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
package argocd
22

33
import (
4-
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
5-
"github.com/hashicorp/terraform-plugin-sdk/terraform"
64
"os"
75
"testing"
6+
7+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
88
)
99

10-
var testAccProviders map[string]terraform.ResourceProvider
11-
var testAccProvider *schema.Provider
10+
var testAccProviders map[string]func() (*schema.Provider, error)
1211

1312
func init() {
14-
testAccProvider = Provider().(*schema.Provider)
15-
testAccProviders = map[string]terraform.ResourceProvider{
16-
"argocd": testAccProvider,
13+
testAccProviders = map[string]func() (*schema.Provider, error){
14+
"argocd": func() (*schema.Provider, error) {
15+
return Provider(), nil
16+
},
1717
}
1818
}
1919

2020
func TestProvider(t *testing.T) {
21-
if err := Provider().(*schema.Provider).InternalValidate(); err != nil {
21+
if err := Provider().InternalValidate(); err != nil {
2222
t.Fatalf("err: %s", err)
2323
}
2424
}

0 commit comments

Comments
 (0)