Skip to content
Open
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 .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/.github/workflows/*.yml @infracost/security
/.github/workflows/*.yml
/tools/release/*.go @infracost/security
24 changes: 24 additions & 0 deletions .github/workflows/test-arm-parser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: ARM Template Parser Tests
on: [push, workflow_dispatch]


env:
PARSER_TEST_PATH: ./internal/providers/arm/parser_test.go

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Go 1.22
uses: actions/setup-go@v4
with:
go-version: 1.22
id: go


- name: Run Parse Resource Data Test
run: go test ./internal/providers/arm -run ./internal/providers/arm/parser_test.go

17 changes: 17 additions & 0 deletions .github/workflows/test-arm-template-provider.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: ARM Template Provider Tests
on: [push, workflow_dispatch]
jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Go 1.22
uses: actions/setup-go@v4
with:
go-version: 1.22
id: go

- name: Run ARM Template Tests
run: go test ./internal/providers/arm -run ./internal/providers/arm/template_provider_test.go
16 changes: 16 additions & 0 deletions cmd/infracost/breakdown_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,22 @@ func TestBreakdownMultiProjectSkipPathsRootLevel(t *testing.T) {
)
}

func TestBreakdownArmTemplateConfigFile(t *testing.T) {
testName := testutil.CalcGoldenFileTestdataDirName()
dir := path.Join("./testdata", testName)
GoldenFileCommandTest(
t,
testutil.CalcGoldenFileTestdataDirName(),
[]string{
"breakdown",
"--config-file", path.Join(dir, "infracost.yml"),
},
&GoldenFileOptions{
IsJSON: true,
},
)
}

func TestBreakdownTerraformDirectoryWithDefaultVarFiles(t *testing.T) {
testName := testutil.CalcGoldenFileTestdataDirName()
dir := path.Join("./testdata", testName)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Project: standard_disk

Name Monthly Qty Unit Monthly Cost

Microsoft.Compute/disks/standard
├─ Storage (S40, LRS) 1 months $85.60
└─ Disk operations Monthly cost depends on usage: $0.0005 per 10k operations

OVERALL TOTAL $85.60

*Usage costs can be estimated by updating Infracost Cloud settings, see docs for other options.

──────────────────────────────────
1 cloud resource was detected:
∙ 1 was estimated

┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃ Project ┃ Baseline cost ┃ Usage cost* ┃ Total cost ┃
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━╋━━━━━━━━━━━━┫
┃ standard_disk ┃ $86 ┃ - ┃ $86 ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━┻━━━━━━━━━━━━┛

Err:

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
version: 0.1
projects:
- path: ./testdata/breakdown_arm_template_config_file/standard_disk.json
name : standard_disk
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.Compute/disks",
"apiVersion": "2023-10-02",
"name": "standard",
"location": "francecentral",
"properties": {
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 2000,
"diskIOPSReadWrite": 4000,
"diskMBpsReadWrite": 20
},
"sku": {
"name": "Standard_LRS"
}
}
]
}
4 changes: 4 additions & 0 deletions examples/arm/managed_disk/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
version: 0.1
projects:
- path: ./examples/arm/managed_disk/standard_disk.json
name : standard_disk
23 changes: 23 additions & 0 deletions examples/arm/managed_disk/standard_disk.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.Compute/disks",
"apiVersion": "2023-10-02",
"name": "standard",
"location": "francecentral",
"properties": {
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 2000,
"diskIOPSReadWrite": 4000,
"diskMBpsReadWrite": 20
},
"sku": {
"name": "Standard_LRS"
}
}
]
}
32 changes: 17 additions & 15 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ require (
github.com/stretchr/testify v1.8.4
github.com/tidwall/gjson v1.17.0
github.com/zclconf/go-cty v1.14.1
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/crypto v0.22.0 // indirect
golang.org/x/mod v0.14.0
gopkg.in/go-playground/assert.v1 v1.2.1
gopkg.in/yaml.v2 v2.4.0
Expand All @@ -48,7 +48,7 @@ require (
require (
github.com/aws/aws-sdk-go-v2/service/eks v1.27.0
github.com/hashicorp/terraform-config-inspect v0.0.0-20210625153042-09f34846faab
golang.org/x/sys v0.20.0 // indirect
golang.org/x/sys v0.21.0 // indirect
)

require (
Expand Down Expand Up @@ -88,7 +88,7 @@ require (
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.35 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
golang.org/x/sync v0.5.0
golang.org/x/sync v0.7.0
)

require (
Expand All @@ -108,22 +108,22 @@ require (
github.com/hashicorp/terraform-svchost v0.1.1
github.com/maruel/panicparse/v2 v2.3.1
github.com/mitchellh/hashstructure/v2 v2.0.2
github.com/pkg/browser v0.0.0-20201207095918-0426ae3fba23
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c
github.com/pkg/profile v1.2.1
github.com/rs/zerolog v1.31.0
github.com/shurcooL/githubv4 v0.0.0-20220115235240-a14260e6f8a2
github.com/shurcooL/graphql v0.0.0-20200928012149-18c5c3165e3a
github.com/shurcooL/graphql v0.0.0-20230722043721-ed46e5a46466
github.com/soongo/path-to-regexp v1.6.4
github.com/spacelift-io/spacectl v1.2.0
github.com/turbot/terraform-components v0.0.0-20231213122222-1f3526cab7a7
github.com/withfig/autocomplete-tools/packages/cobra v1.2.0
github.com/xanzy/go-gitlab v0.86.0
golang.org/x/oauth2 v0.8.0
golang.org/x/oauth2 v0.21.0
k8s.io/apimachinery v0.29.2
)

require (
cloud.google.com/go/compute v1.19.1 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/compute/metadata v0.3.0 // indirect
cloud.google.com/go/iam v0.13.0 // indirect
dario.cat/mergo v1.0.0 // indirect
filippo.io/age v1.0.0 // indirect
Expand Down Expand Up @@ -153,15 +153,15 @@ require (
github.com/cenkalti/backoff/v3 v3.2.2 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/containerd/continuity v0.3.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
github.com/creack/pty v1.1.11 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/dimchansky/utfbom v1.1.1 // indirect
github.com/dlclark/regexp2 v1.8.1 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.3.0 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/go-github/v35 v35.3.0 // indirect
Expand Down Expand Up @@ -199,7 +199,7 @@ require (
github.com/owenrumney/go-sarif v1.1.1 // indirect
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/ryanuber/go-glob v1.0.0 // indirect
github.com/sergi/go-diff v1.2.0 // indirect
Expand All @@ -211,16 +211,16 @@ require (
github.com/terraform-linters/tflint v0.46.1 // indirect
github.com/terraform-linters/tflint-plugin-sdk v0.16.1 // indirect
github.com/terraform-linters/tflint-ruleset-terraform v0.3.0 // indirect
github.com/urfave/cli/v2 v2.25.5 // indirect
github.com/urfave/cli/v2 v2.27.2 // indirect
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 // indirect
go.mozilla.org/gopgagent v0.0.0-20170926210634-4d7ea76ff71a // indirect
go.mozilla.org/sops/v3 v3.7.3 // indirect
go.uber.org/atomic v1.9.0 // indirect
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/term v0.21.0 // indirect
golang.org/x/time v0.3.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.66.4 // indirect
Expand Down Expand Up @@ -261,7 +261,7 @@ require (
github.com/yashtewari/glob-intersection v0.1.0 // indirect
github.com/zclconf/go-cty-yaml v1.0.3
go.opencensus.io v0.24.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/net v0.24.0 // indirect
google.golang.org/api v0.114.0
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
Expand All @@ -277,3 +277,5 @@ replace github.com/spf13/cobra => github.com/spf13/cobra v1.4.0
replace github.com/gruntwork-io/terragrunt => github.com/infracost/terragrunt v0.47.1-0.20240501143558-4c01e72103df

replace github.com/heimdalr/dag => github.com/aliscott/dag v1.3.2-0.20231115114512-4ce18c825f94

replace github.com/shurcooL/graphql => github.com/spacelift-io/graphql v1.2.0
Loading