Skip to content
This repository has been archived by the owner on Jan 18, 2021. It is now read-only.

Commit

Permalink
Updated to use go modules
Browse files Browse the repository at this point in the history
removed the vendor directory and initiated as a module
updated tfjson_test
Updated circle ci config
Added env variable to turn on modules
added env variable to test run and added names to runs
updated env variable
installed terraform
downloading dependencies before building terraform
  • Loading branch information
Andrew Partis committed Apr 15, 2019
1 parent 5712341 commit fae302c
Show file tree
Hide file tree
Showing 1,091 changed files with 343,848 additions and 16,487 deletions.
54 changes: 54 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
version: 2.1

orbs:
go: palantir/go@0.0.11

jobs:
verify:
parameters:
executor:
description: |
The executor used for this job.
type: executor
usevendor:
description: |
Use the vendor directory for older versions of go
type: boolean
default: true
executor: << parameters.executor >>
steps:
- go/setup:
restore-mod-cache: false
- unless:
condition: << parameters.usevendor >>
steps:
- run: go get -v ./...
- run: go version
- run: go build .

workflows:
version: 2
verify:
jobs:
- verify:
name: verify-go-1.12
executor:
name: go/golang
owner-repo: palantir/tfjson
version: 1.12.2
module: true
- verify:
name: verify-go-1.11
executor:
name: go/golang
owner-repo: palantir/tfjson
version: 1.11.8
module: true
- verify:
name: verify-go-1.10
executor:
name: go/golang
owner-repo: palantir/tfjson
version: 1.10.8
module: false
usevendor: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.iml
*.ipr
.terraform/
37 changes: 0 additions & 37 deletions circle.yml

This file was deleted.

5 changes: 5 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/palantir/tfjson

go 1.12

require github.com/hashicorp/terraform v0.11.13
265 changes: 265 additions & 0 deletions go.sum

Large diffs are not rendered by default.

33 changes: 23 additions & 10 deletions tfjson_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@ module "inner" {

const innerTF = `
resource "aws_vpc" "inner" {
cidr_block = "10.0.0.0/8"
cidr_block = "10.0.0.0/28"
}
`

const expected = `{
"aws_vpc.main": {
"arn": "",
"assign_generated_ipv6_cidr_block": "false",
"cidr_block": "10.0.0.0/16",
"default_network_acl_id": "",
"default_route_table_id": "",
Expand All @@ -60,35 +62,45 @@ const expected = `{
"destroy_tainted": false,
"dhcp_options_id": "",
"enable_classiclink": "",
"enable_classiclink_dns_support": "",
"enable_dns_hostnames": "",
"enable_dns_support": "",
"enable_dns_support": "true",
"id": "",
"instance_tenancy": "",
"main_route_table_id": ""
"instance_tenancy": "default",
"ipv6_association_id": "",
"ipv6_cidr_block": "",
"main_route_table_id": "",
"owner_id": ""
},
"destroy": false,
"inner": {
"aws_vpc.inner": {
"cidr_block": "10.0.0.0/8",
"arn": "",
"assign_generated_ipv6_cidr_block": "false",
"cidr_block": "10.0.0.0/28",
"default_network_acl_id": "",
"default_route_table_id": "",
"default_security_group_id": "",
"destroy": false,
"destroy_tainted": false,
"dhcp_options_id": "",
"enable_classiclink": "",
"enable_classiclink_dns_support": "",
"enable_dns_hostnames": "",
"enable_dns_support": "",
"enable_dns_support": "true",
"id": "",
"instance_tenancy": "",
"main_route_table_id": ""
"instance_tenancy": "default",
"ipv6_association_id": "",
"ipv6_cidr_block": "",
"main_route_table_id": "",
"owner_id": ""
},
"destroy": false
}
}`

func Test(t *testing.T) {
dir, err := ioutil.TempDir("", "")
dir, err := ioutil.TempDir("./", "")
if err != nil {
t.Fatal(err)
}
Expand All @@ -109,7 +121,8 @@ func Test(t *testing.T) {

planPath := filepath.Join(dir, "terraform.tfplan")
mustRun(t, "terraform", "get", dir)
mustRun(t, "terraform", "plan", "-out="+planPath, dir)
mustRun(t, "terraform", "init", "-backend=false", "-get=true", "-get-plugins=true", dir)
mustRun(t, "terraform", "plan", "-refresh=false", "-state=null", "-out="+planPath, dir)

j, err := tfjson(planPath)
if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions vendor/github.com/agext/levenshtein/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

70 changes: 70 additions & 0 deletions vendor/github.com/agext/levenshtein/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions vendor/github.com/agext/levenshtein/DCO

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fae302c

Please sign in to comment.