Skip to content

Commit

Permalink
chore: terraform interface{} -> any
Browse files Browse the repository at this point in the history
Signed-off-by: thxCode <[email protected]>
  • Loading branch information
thxCode committed Feb 3, 2024
1 parent 08b83d8 commit 07eb4cb
Show file tree
Hide file tree
Showing 193 changed files with 2,579 additions and 2,581 deletions.
26 changes: 13 additions & 13 deletions staging/terraform/backend/remote-state/azure/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestBackendConfig(t *testing.T) {
// This test just instantiates the client. Shouldn't make any actual
// requests nor incur any costs.

config := map[string]interface{}{
config := map[string]any{
"storage_account_name": "tfaccount",
"container_name": "tfcontainer",
"key": "state",
Expand Down Expand Up @@ -56,7 +56,7 @@ func TestAccBackendAccessKeyBasic(t *testing.T) {
t.Fatalf("Error creating Test Resources: %q", err)
}

b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"storage_account_name": res.storageAccountName,
"container_name": res.storageContainerName,
"key": res.storageKeyName,
Expand Down Expand Up @@ -86,7 +86,7 @@ func TestAccBackendSASTokenBasic(t *testing.T) {
t.Fatalf("Error building SAS Token: %+v", err)
}

b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"storage_account_name": res.storageAccountName,
"container_name": res.storageContainerName,
"key": res.storageKeyName,
Expand All @@ -111,7 +111,7 @@ func TestAccBackendOIDCBasic(t *testing.T) {
t.Fatalf("Error creating Test Resources: %q", err)
}

b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"storage_account_name": res.storageAccountName,
"container_name": res.storageContainerName,
"key": res.storageKeyName,
Expand Down Expand Up @@ -141,7 +141,7 @@ func TestAccBackendAzureADAuthBasic(t *testing.T) {
t.Fatalf("Error creating Test Resources: %q", err)
}

b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"storage_account_name": res.storageAccountName,
"container_name": res.storageContainerName,
"key": res.storageKeyName,
Expand All @@ -167,7 +167,7 @@ func TestAccBackendManagedServiceIdentityBasic(t *testing.T) {
t.Fatalf("Error creating Test Resources: %q", err)
}

b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"storage_account_name": res.storageAccountName,
"container_name": res.storageContainerName,
"key": res.storageKeyName,
Expand Down Expand Up @@ -202,7 +202,7 @@ func TestAccBackendServicePrincipalClientCertificateBasic(t *testing.T) {
t.Fatalf("Error creating Test Resources: %q", err)
}

b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"storage_account_name": res.storageAccountName,
"container_name": res.storageContainerName,
"key": res.storageKeyName,
Expand Down Expand Up @@ -232,7 +232,7 @@ func TestAccBackendServicePrincipalClientSecretBasic(t *testing.T) {
t.Fatalf("Error creating Test Resources: %q", err)
}

b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"storage_account_name": res.storageAccountName,
"container_name": res.storageContainerName,
"key": res.storageKeyName,
Expand Down Expand Up @@ -268,7 +268,7 @@ func TestAccBackendServicePrincipalClientSecretCustomEndpoint(t *testing.T) {
t.Fatalf("Error creating Test Resources: %q", err)
}

b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"storage_account_name": res.storageAccountName,
"container_name": res.storageContainerName,
"key": res.storageKeyName,
Expand Down Expand Up @@ -297,7 +297,7 @@ func TestAccBackendAccessKeyLocked(t *testing.T) {
t.Fatalf("Error creating Test Resources: %q", err)
}

b1 := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
b1 := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"storage_account_name": res.storageAccountName,
"container_name": res.storageContainerName,
"key": res.storageKeyName,
Expand All @@ -306,7 +306,7 @@ func TestAccBackendAccessKeyLocked(t *testing.T) {
"endpoint": os.Getenv("ARM_ENDPOINT"),
})).(*Backend)

b2 := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
b2 := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"storage_account_name": res.storageAccountName,
"container_name": res.storageContainerName,
"key": res.storageKeyName,
Expand Down Expand Up @@ -335,7 +335,7 @@ func TestAccBackendServicePrincipalLocked(t *testing.T) {
t.Fatalf("Error creating Test Resources: %q", err)
}

b1 := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
b1 := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"storage_account_name": res.storageAccountName,
"container_name": res.storageContainerName,
"key": res.storageKeyName,
Expand All @@ -348,7 +348,7 @@ func TestAccBackendServicePrincipalLocked(t *testing.T) {
"endpoint": os.Getenv("ARM_ENDPOINT"),
})).(*Backend)

b2 := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
b2 := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"storage_account_name": res.storageAccountName,
"container_name": res.storageContainerName,
"key": res.storageKeyName,
Expand Down
16 changes: 8 additions & 8 deletions staging/terraform/backend/remote-state/azure/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestRemoteClientAccessKeyBasic(t *testing.T) {
t.Fatalf("Error creating Test Resources: %q", err)
}

b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"storage_account_name": res.storageAccountName,
"container_name": res.storageContainerName,
"key": res.storageKeyName,
Expand Down Expand Up @@ -62,7 +62,7 @@ func TestRemoteClientManagedServiceIdentityBasic(t *testing.T) {
t.Fatalf("Error creating Test Resources: %q", err)
}

b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"storage_account_name": res.storageAccountName,
"container_name": res.storageContainerName,
"key": res.storageKeyName,
Expand Down Expand Up @@ -100,7 +100,7 @@ func TestRemoteClientSasTokenBasic(t *testing.T) {
t.Fatalf("Error building SAS Token: %+v", err)
}

b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"storage_account_name": res.storageAccountName,
"container_name": res.storageContainerName,
"key": res.storageKeyName,
Expand Down Expand Up @@ -130,7 +130,7 @@ func TestRemoteClientServicePrincipalBasic(t *testing.T) {
t.Fatalf("Error creating Test Resources: %q", err)
}

b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"storage_account_name": res.storageAccountName,
"container_name": res.storageContainerName,
"key": res.storageKeyName,
Expand Down Expand Up @@ -164,7 +164,7 @@ func TestRemoteClientAccessKeyLocks(t *testing.T) {
t.Fatalf("Error creating Test Resources: %q", err)
}

b1 := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
b1 := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"storage_account_name": res.storageAccountName,
"container_name": res.storageContainerName,
"key": res.storageKeyName,
Expand All @@ -173,7 +173,7 @@ func TestRemoteClientAccessKeyLocks(t *testing.T) {
"endpoint": os.Getenv("ARM_ENDPOINT"),
})).(*Backend)

b2 := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
b2 := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"storage_account_name": res.storageAccountName,
"container_name": res.storageContainerName,
"key": res.storageKeyName,
Expand Down Expand Up @@ -208,7 +208,7 @@ func TestRemoteClientServicePrincipalLocks(t *testing.T) {
t.Fatalf("Error creating Test Resources: %q", err)
}

b1 := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
b1 := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"storage_account_name": res.storageAccountName,
"container_name": res.storageContainerName,
"key": res.storageKeyName,
Expand All @@ -221,7 +221,7 @@ func TestRemoteClientServicePrincipalLocks(t *testing.T) {
"endpoint": os.Getenv("ARM_ENDPOINT"),
})).(*Backend)

b2 := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
b2 := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"storage_account_name": res.storageAccountName,
"container_name": res.storageContainerName,
"key": res.storageKeyName,
Expand Down
10 changes: 5 additions & 5 deletions staging/terraform/backend/remote-state/consul/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ func TestBackend(t *testing.T) {
path := fmt.Sprintf("tf-unit/%s", time.Now().String())

// Get the backend. We need two to test locking.
b1 := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
b1 := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"address": srv.HTTPAddr,
"path": path,
}))

b2 := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
b2 := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"address": srv.HTTPAddr,
"path": path,
}))
Expand All @@ -74,13 +74,13 @@ func TestBackend_lockDisabled(t *testing.T) {
path := fmt.Sprintf("tf-unit/%s", time.Now().String())

// Get the backend. We need two to test locking.
b1 := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
b1 := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"address": srv.HTTPAddr,
"path": path,
"lock": false,
}))

b2 := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
b2 := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"address": srv.HTTPAddr,
"path": path + "different", // Diff so locking test would fail if it was locking
"lock": false,
Expand All @@ -95,7 +95,7 @@ func TestBackend_gzip(t *testing.T) {
srv := newConsulTestServer(t)

// Get the backend
b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"address": srv.HTTPAddr,
"path": fmt.Sprintf("tf-unit/%s", time.Now().String()),
"gzip": true,
Expand Down
6 changes: 3 additions & 3 deletions staging/terraform/backend/remote-state/consul/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ func (c *RemoteClient) Put(data []byte) error {
}

// Then we update the link to point to the new chunks
payload, err = json.Marshal(map[string]interface{}{
payload, err = json.Marshal(map[string]any{
"current-hash": fmt.Sprintf("%x", md5),
"chunks": chunkPaths,
})
Expand Down Expand Up @@ -669,7 +669,7 @@ func (c *RemoteClient) chunkedMode() (bool, string, []string, *consulapi.KVPair,
return false, "", nil, pair, err
}
if pair != nil {
var d map[string]interface{}
var d map[string]any
err = json.Unmarshal(pair.Value, &d)
// If there is an error when unmarshaling the payload, the state has
// probably been gziped in single entry mode.
Expand All @@ -678,7 +678,7 @@ func (c *RemoteClient) chunkedMode() (bool, string, []string, *consulapi.KVPair,
hash, ok := d["current-hash"]
if ok {
chunks := make([]string, 0)
for _, c := range d["chunks"].([]interface{}) {
for _, c := range d["chunks"].([]any) {
chunks = append(chunks, c.(string))
}
return true, hash.(string), chunks, pair, nil
Expand Down
22 changes: 11 additions & 11 deletions staging/terraform/backend/remote-state/consul/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestRemoteClient(t *testing.T) {
for _, path := range testCases {
t.Run(path, func(*testing.T) {
// Get the backend
b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"address": srv.HTTPAddr,
"path": path,
}))
Expand All @@ -61,7 +61,7 @@ func TestRemoteClient_gzipUpgrade(t *testing.T) {
statePath := fmt.Sprintf("tf-unit/%s", time.Now().String())

// Get the backend
b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"address": srv.HTTPAddr,
"path": statePath,
}))
Expand All @@ -76,7 +76,7 @@ func TestRemoteClient_gzipUpgrade(t *testing.T) {
remote.TestClient(t, state.(*remote.State).Client)

// create a new backend with gzip
b = backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
b = backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"address": srv.HTTPAddr,
"path": statePath,
"gzip": true,
Expand All @@ -100,7 +100,7 @@ func TestConsul_largeState(t *testing.T) {

path := "tf-unit/test-large-state"

b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"address": srv.HTTPAddr,
"path": path,
}))
Expand Down Expand Up @@ -186,7 +186,7 @@ func TestConsul_largeState(t *testing.T) {
)

// Test with gzip and chunks
b = backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
b = backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"address": srv.HTTPAddr,
"path": path,
"gzip": true,
Expand Down Expand Up @@ -247,15 +247,15 @@ func TestConsul_stateLock(t *testing.T) {
for _, path := range testCases {
t.Run(path, func(*testing.T) {
// create 2 instances to get 2 remote.Clients
sA, err := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
sA, err := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"address": srv.HTTPAddr,
"path": path,
})).StateMgr(backend.DefaultStateName)
if err != nil {
t.Fatal(err)
}

sB, err := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
sB, err := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"address": srv.HTTPAddr,
"path": path,
})).StateMgr(backend.DefaultStateName)
Expand Down Expand Up @@ -290,7 +290,7 @@ func TestConsul_destroyLock(t *testing.T) {
for _, path := range testCases {
t.Run(path, func(*testing.T) {
// Get the backend
b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"address": srv.HTTPAddr,
"path": path,
}))
Expand Down Expand Up @@ -356,15 +356,15 @@ func TestConsul_lostLock(t *testing.T) {
path := fmt.Sprintf("tf-unit/%s", time.Now().String())

// create 2 instances to get 2 remote.Clients
sA, err := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
sA, err := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"address": srv.HTTPAddr,
"path": path,
})).StateMgr(backend.DefaultStateName)
if err != nil {
t.Fatal(err)
}

sB, err := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
sB, err := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"address": srv.HTTPAddr,
"path": path + "-not-used",
})).StateMgr(backend.DefaultStateName)
Expand Down Expand Up @@ -413,7 +413,7 @@ func TestConsul_lostLockConnection(t *testing.T) {

path := fmt.Sprintf("tf-unit/%s", time.Now().String())

b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]any{
"address": srv.HTTPAddr,
"path": path,
}))
Expand Down
Loading

0 comments on commit 07eb4cb

Please sign in to comment.