Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ci/cloudbuild-tests-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ steps:
args:
[
"-c",
"mv /terraform/$_TERRAFORM_VERSION /bin/terraform && /usr/bin/make test-integration",
"/usr/bin/make test-integration",
]
env:
- TEST_PROJECT=$_TEST_PROJECT
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ test:
GO111MODULE=on go test -short ./...

test-integration:
env
go version
terraform --version
go test -run=CLI ./...
go test -v -run=CLI ./...

test-go-licenses:
cd .. && go version && go install github.com/google/go-licenses@latest
Expand Down
4 changes: 4 additions & 0 deletions tfplan2cai/converters/google/resources/getconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package google

import (
"context"
"fmt"
"net/http"

"github.com/pkg/errors"
Expand All @@ -24,6 +25,8 @@ func NewConfig(ctx context.Context, project, zone, region string, offline bool,
"GCLOUD_KEYFILE_JSON",
})

fmt.Printf("cfg.Credentials = %v\n", cfg.Credentials)

cfg.AccessToken = transport_tpg.MultiEnvSearch([]string{
"GOOGLE_OAUTH_ACCESS_TOKEN",
})
Expand All @@ -34,6 +37,7 @@ func NewConfig(ctx context.Context, project, zone, region string, offline bool,

transport_tpg.ConfigureBasePaths(cfg)
if !offline {
fmt.Println("online....")
if err := cfg.LoadAndValidate(ctx); err != nil {
return nil, errors.Wrap(err, "load and validate config")
}
Expand Down
2 changes: 1 addition & 1 deletion tfplan2cai/test/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func TestCLI(t *testing.T) {
}

// Test both offline and online mode.
for _, offline := range []bool{true, false} {
for _, offline := range []bool{true} {
offline := offline
t.Run(fmt.Sprintf("v=0.12/tf=%s/offline=%t", c.name, offline), func(t *testing.T) {
t.Parallel()
Expand Down
1 change: 0 additions & 1 deletion tfplan2cai/test/environment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ func getTestCredsFromEnv() string {
} else {
log.Printf("missing env var TEST_CREDENTIALS, will try to use Application Default Credentials")
}

return credentials
}

Expand Down
1 change: 1 addition & 0 deletions tfplan2cai/test/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ func init() {
FolderID: folder,
Ancestry: ancestry,
}
fmt.Printf("data = %v\n", *data)
}

func generateTestFiles(t *testing.T, sourceDir string, targetDir string, selector string) {
Expand Down
2 changes: 2 additions & 0 deletions tfplan2cai/test/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ func terraformWorkflow(t *testing.T, dir, name string) {
terraformInit(t, "terraform", dir)
terraformPlan(t, "terraform", dir, name+".tfplan")
payload := terraformShow(t, "terraform", dir, name+".tfplan")
c, _ := os.ReadFile(filepath.Join(dir, name+".tf"))
fmt.Println(string(c))
saveFile(t, dir, name+".tfplan.json", payload)
}

Expand Down