Skip to content
This repository has been archived by the owner on May 15, 2023. It is now read-only.

Updated terraform-google-conversion to latest version #85

Merged
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 0 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ prepare-v11:
cp go_tf_0_11.sum go.sum
go mod vendor

prepare-v12:
@echo "Prepare the environment for TF v0.12"
cp go_tf_0_12.mod go.mod
cp go_tf_0_12.sum go.sum
go mod vendor

test:
# Skip integration tests in ./test/
GO111MODULE=on go test -tags=$(BUILDTAGS) `go list -tags=$(BUILDTAGS) ./... | grep -v terraform-validator/test`
Expand Down
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ terraform-validator validate --policy-path=${POLICY_PATH} ./terraform.tfplan
terraform apply ./terraform.tfplan
```

```
# Restore to use Terraform v0.12.
make prepare-v12 build
```

### Terraform v0.12

For 0.12 Terraform release validator required plan exported in JSON format
Expand Down
5 changes: 3 additions & 2 deletions converters/google/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"fmt"
"sort"

"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/pkg/errors"
provider "github.com/terraform-providers/terraform-provider-google/google"

Expand Down Expand Up @@ -93,9 +93,10 @@ func NewConverter(ancestryManager ancestrymanager.AncestryManager, project, cred
if !offline {
converter.ConfigureBasePaths(cfg)
if err := cfg.LoadAndValidate(); err != nil {
return nil, errors.Wrap(err, "load and validate config")
return nil, errors.Wrap(err, "load and validate config")
}
}

p := provider.Provider().(*schema.Provider)
return &Converter{
schema: p,
Expand Down
1 change: 1 addition & 0 deletions example/terraform.tfplan.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"format_version":"0.1","terraform_version":"0.12.10","variables":{"project_id":{"value":"rcanty-project-1022"}},"planned_values":{"root_module":{"resources":[{"address":"google_compute_disk.my-disk","mode":"managed","type":"google_compute_disk","name":"my-disk","provider_name":"google","schema_version":0,"values":{"description":null,"disk_encryption_key":[],"disk_encryption_key_raw":null,"image":"debian-8-jessie-v20170523","labels":{"foo":"bar"},"name":"my-disk","project":"rcanty-project-1022","snapshot":null,"source_image_encryption_key":[],"source_snapshot_encryption_key":[],"timeouts":null,"type":"pd-ssd","zone":"us-central1-a"}},{"address":"google_compute_firewall.my-test-firewall","mode":"managed","type":"google_compute_firewall","name":"my-test-firewall","provider_name":"google","schema_version":1,"values":{"allow":[{"ports":["80","8080","1000-2000"],"protocol":"tcp"},{"ports":[],"protocol":"icmp"}],"deny":[],"description":null,"disabled":null,"name":"my-test-firewall","network":"default","priority":1000,"source_service_accounts":null,"source_tags":["web"],"target_service_accounts":null,"target_tags":null,"timeouts":null}},{"address":"google_storage_bucket.my-bucket","mode":"managed","type":"google_storage_bucket","name":"my-bucket","provider_name":"google","schema_version":0,"values":{"cors":[{"max_age_seconds":null,"method":["POST"],"origin":["*"],"response_header":null}],"encryption":[],"force_destroy":false,"labels":{"foo":"bar"},"lifecycle_rule":[],"location":"US","logging":[],"predefined_acl":null,"project":"rcanty-project-1022","requester_pays":null,"storage_class":"STANDARD","versioning":[],"website":[{"main_page_suffix":"index.html","not_found_page":"404.html"}]}},{"address":"random_id.bucket","mode":"managed","type":"random_id","name":"bucket","provider_name":"random","schema_version":0,"values":{"byte_length":8,"keepers":null,"prefix":null}}]}},"resource_changes":[{"address":"google_compute_disk.my-disk","mode":"managed","type":"google_compute_disk","name":"my-disk","provider_name":"google","change":{"actions":["create"],"before":null,"after":{"description":null,"disk_encryption_key":[],"disk_encryption_key_raw":null,"image":"debian-8-jessie-v20170523","labels":{"foo":"bar"},"name":"my-disk","project":"rcanty-project-1022","snapshot":null,"source_image_encryption_key":[],"source_snapshot_encryption_key":[],"timeouts":null,"type":"pd-ssd","zone":"us-central1-a"},"after_unknown":{"creation_timestamp":true,"disk_encryption_key":[],"disk_encryption_key_sha256":true,"id":true,"label_fingerprint":true,"labels":{},"last_attach_timestamp":true,"last_detach_timestamp":true,"physical_block_size_bytes":true,"self_link":true,"size":true,"source_image_encryption_key":[],"source_image_id":true,"source_snapshot_encryption_key":[],"source_snapshot_id":true,"users":true}}},{"address":"google_compute_firewall.my-test-firewall","mode":"managed","type":"google_compute_firewall","name":"my-test-firewall","provider_name":"google","change":{"actions":["create"],"before":null,"after":{"allow":[{"ports":["80","8080","1000-2000"],"protocol":"tcp"},{"ports":[],"protocol":"icmp"}],"deny":[],"description":null,"disabled":null,"name":"my-test-firewall","network":"default","priority":1000,"source_service_accounts":null,"source_tags":["web"],"target_service_accounts":null,"target_tags":null,"timeouts":null},"after_unknown":{"allow":[{"ports":[false,false,false]},{"ports":[]}],"creation_timestamp":true,"deny":[],"destination_ranges":true,"direction":true,"id":true,"project":true,"self_link":true,"source_ranges":true,"source_tags":[false]}}},{"address":"google_storage_bucket.my-bucket","mode":"managed","type":"google_storage_bucket","name":"my-bucket","provider_name":"google","change":{"actions":["create"],"before":null,"after":{"cors":[{"max_age_seconds":null,"method":["POST"],"origin":["*"],"response_header":null}],"encryption":[],"force_destroy":false,"labels":{"foo":"bar"},"lifecycle_rule":[],"location":"US","logging":[],"predefined_acl":null,"project":"rcanty-project-1022","requester_pays":null,"storage_class":"STANDARD","versioning":[],"website":[{"main_page_suffix":"index.html","not_found_page":"404.html"}]},"after_unknown":{"bucket_policy_only":true,"cors":[{"method":[false],"origin":[false]}],"encryption":[],"id":true,"labels":{},"lifecycle_rule":[],"logging":[],"name":true,"self_link":true,"url":true,"versioning":[],"website":[{}]}}},{"address":"random_id.bucket","mode":"managed","type":"random_id","name":"bucket","provider_name":"random","change":{"actions":["create"],"before":null,"after":{"byte_length":8,"keepers":null,"prefix":null},"after_unknown":{"b64":true,"b64_std":true,"b64_url":true,"dec":true,"hex":true,"id":true}}}],"configuration":{"provider_config":{"google":{"name":"google","version_constraint":"~\u003e 2.11.0","expressions":{"project":{"references":["local.project"]}}}},"root_module":{"resources":[{"address":"google_compute_disk.my-disk","mode":"managed","type":"google_compute_disk","name":"my-disk","provider_config_key":"google","expressions":{"image":{"constant_value":"debian-8-jessie-v20170523"},"labels":{"constant_value":{"foo":"bar"}},"name":{"constant_value":"my-disk"},"project":{"references":["local.project"]},"type":{"constant_value":"pd-ssd"},"zone":{"constant_value":"us-central1-a"}},"schema_version":0},{"address":"google_compute_firewall.my-test-firewall","mode":"managed","type":"google_compute_firewall","name":"my-test-firewall","provider_config_key":"google","expressions":{"allow":[{"protocol":{"constant_value":"icmp"}},{"ports":{"constant_value":["80","8080","1000-2000"]},"protocol":{"constant_value":"tcp"}}],"name":{"constant_value":"my-test-firewall"},"network":{"constant_value":"default"},"source_tags":{"constant_value":["web"]}},"schema_version":1},{"address":"google_storage_bucket.my-bucket","mode":"managed","type":"google_storage_bucket","name":"my-bucket","provider_config_key":"google","expressions":{"cors":[{"method":{"constant_value":["POST"]},"origin":{"constant_value":["*"]}}],"labels":{"constant_value":{"foo":"bar"}},"location":{"constant_value":"US"},"name":{"references":["random_id.bucket"]},"project":{"references":["local.project"]},"website":[{"main_page_suffix":{"constant_value":"index.html"},"not_found_page":{"constant_value":"404.html"}}]},"schema_version":0},{"address":"random_id.bucket","mode":"managed","type":"random_id","name":"bucket","provider_config_key":"random","expressions":{"byte_length":{"constant_value":8}},"schema_version":0}],"variables":{"project_id":{"description":"The project to create resources inside of."}}}}}
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
module github.com/GoogleCloudPlatform/terraform-validator

require (
github.com/GoogleCloudPlatform/terraform-google-conversion v0.0.0-20190826162802-791ccb94729b
github.com/GoogleCloudPlatform/terraform-google-conversion v0.0.0-20191024191752-54004ba54ac1
github.com/forseti-security/config-validator v0.0.0-20190619160113-b8fae8e864e3
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/golang/protobuf v1.3.1
github.com/golang/protobuf v1.3.2
github.com/hashicorp/hil v0.0.0-20190212132231-97b3a9cdfa93 // indirect
github.com/hashicorp/terraform v0.12.6
github.com/hashicorp/terraform-plugin-sdk v1.2.0
github.com/hashicorp/vault v1.0.2 // indirect
github.com/pkg/errors v0.8.1
github.com/spf13/cobra v0.0.4
github.com/stretchr/testify v1.3.0
github.com/terraform-providers/terraform-provider-google v2.13.0+incompatible
google.golang.org/api v0.6.0
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873
github.com/terraform-providers/terraform-provider-google v0.0.0-20190926053353-6d9ad351701b
google.golang.org/api v0.9.0
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55
)

go 1.13
Loading