Skip to content

Commit

Permalink
feat: add support for Google Cloud Run resources (infracost#3067)
Browse files Browse the repository at this point in the history
* feat: generate cloudrun service resource files

* feat: add cpu throttling cost component

* feat: add region tier mapping

* feat: add number of requests cost component

* chore: usage and region change

* feat: add memory usage

* chore: memory cpu seconds

* feat: add free cloudrun resources

* chore: move region tier mapping to utils

* feat: add cloud run job

* feat: add cloud run v2 service

* chore: fetch min instance count from tf code

* feat(google): add cloud run resources usage example

* chore: format cloud_run resources files

* chore: stylistic changes to make consistent with other resources

* chore: update labels to fix golden tests

* chore: update golden files tests

---------

Co-authored-by: Alistair Scott <[email protected]>
  • Loading branch information
awaismemon26 and aliscott authored May 27, 2024
1 parent f45e8fa commit bd801a6
Show file tree
Hide file tree
Showing 26 changed files with 978 additions and 38 deletions.
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ require (
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/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/snappy v0.0.4 // indirect
Expand Down Expand Up @@ -220,10 +221,12 @@ require (
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
golang.org/x/term v0.18.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
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
gopkg.in/urfave/cli.v1 v1.20.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
k8s.io/apimachinery v0.29.2 // indirect
)

require (
Expand Down
19 changes: 19 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,7 @@ github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa
github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4=
github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/compress v1.15.11 h1:Lcadnb3RKGin4FYM/orgq0qde+nc15E5Cbqg4B9Sx9c=
github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM=
Expand Down Expand Up @@ -1025,6 +1026,12 @@ github.com/onsi/gomega v0.0.0-20190113212917-5533ce8a0da3/go.mod h1:ex+gbHU/CVuB
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8=
github.com/onsi/gomega v1.30.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/onsi/gomega v1.12.0/go.mod h1:lRk9szgn8TxENtWd0Tp4c3wjlRfMTMH27I+3Je41yGY=
github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI=
github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M=
github.com/onsi/gomega v1.29.0 h1:KIA/t2t5UBzoirT4H9tsML45GEbo3ouUnBHsCfD2tVg=
github.com/open-policy-agent/opa v0.46.1 h1:iG998SLK0rzalex7Hyekeq17b9WtUexM0AuyHrQ7fCc=
github.com/open-policy-agent/opa v0.46.1/go.mod h1:DY9ZkCyz+DKoWI5gDuLw5rGC2RSb37QUeEf+9VjsWkI=
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
Expand Down Expand Up @@ -1328,6 +1335,8 @@ golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY=
golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -1438,6 +1447,8 @@ golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ=
golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE=
golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down Expand Up @@ -1606,6 +1617,7 @@ golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roY
golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
Expand All @@ -1615,6 +1627,7 @@ golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4f
golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
Expand All @@ -1624,6 +1637,8 @@ golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc=
golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg=
golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA=
golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down Expand Up @@ -1869,6 +1884,8 @@ gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMy
gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM=
gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE=
gopkg.in/inf.v0 v0.9.0/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/ini.v1 v1.66.4 h1:SsAcf+mM7mRZo2nJNGt8mZCjG8ZRaNGMURJw7BsIST4=
gopkg.in/ini.v1 v1.66.4/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
Expand Down Expand Up @@ -1906,6 +1923,8 @@ honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9
k8s.io/api v0.0.0-20190620084959-7cf5895f2711/go.mod h1:TBhBqb1AWbBQbW3XRusr7n7E4v2+5ZY8r8sAMnyFC5A=
k8s.io/apimachinery v0.0.0-20190612205821-1799e75a0719/go.mod h1:I4A+glKBHiTgiEjQiCCQfCAIcIMFGt291SmsvcrFzJA=
k8s.io/apimachinery v0.0.0-20190913080033-27d36303b655/go.mod h1:nL6pwRT8NgfF8TT68DBI8uEePRt89cSvoXUVqbkWHq4=
k8s.io/apimachinery v0.29.2 h1:EWGpfJ856oj11C52NRCHuU7rFDwxev48z+6DSlGNsV8=
k8s.io/apimachinery v0.29.2/go.mod h1:6HVkd1FwxIagpYrHSwJlQqZI3G9LfYWRPAkUvLnXTKU=
k8s.io/client-go v10.0.0+incompatible/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s=
k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
Expand Down
20 changes: 20 additions & 0 deletions infracost-usage-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,26 @@ resource_usage:
monthly_storage_write_api_gb: 1000 # Monthly number of storage write api in GB.
monthly_storage_read_api_tb: 1000 # Monthly number of storage read api in TB.

google_cloud_run_service.throttling_enabled:
monthly_requests: 500000 # Monthly number of requests.
average_request_duration_ms: 3600 # Average duration of each request in milliseconds.
concurrent_requests_per_instance: 1 # Number of concurrent requests per instance.

google_cloud_run_service.throttling_disabled:
instance_hrs: 730 # Number of instance hours used.

google_cloud_run_v2_service.throttling_enabled:
monthly_requests: 500000 # Monthly number of requests.
average_request_duration_ms: 3600 # Average duration of each request in milliseconds.
concurrent_requests_per_instance: 1 # Number of concurrent requests per instance.

google_cloud_run_v2_service.throttling_disabled:
instance_hrs: 730 # Number of instance hours used.

google_cloud_run_v2_job.my_job:
monthly_job_executions: 50000 # Monthly number of job executions.
average_task_execution_mins: 10 # Average duration of each task execution in minutes.

google_cloudfunctions_function.my_function:
request_duration_ms: 300 # Average duration of each request in milliseconds.
monthly_function_invocations: 10000000 # Monthly number of function invocations.
Expand Down
51 changes: 51 additions & 0 deletions internal/providers/terraform/google/cloud_run_service.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package google

import (
"github.com/infracost/infracost/internal/resources/google"
"github.com/infracost/infracost/internal/schema"
"k8s.io/apimachinery/pkg/api/resource"
)

func getCloudRunServiceRegistryItem() *schema.RegistryItem {
return &schema.RegistryItem{
Name: "google_cloud_run_service",
RFunc: newCloudRunService,
}
}

func newCloudRunService(d *schema.ResourceData, u *schema.UsageData) *schema.Resource {
region := d.Get("location").String()
cpuThrottling := true
minScale := float64(0.5)
annotations := d.Get("metadata.0.annotations").Map()
limits := d.Get("template.0.spec.0.containers.0.resources.0.limits").Map()
if val, ok := annotations["run.googleapis.com/cpu-throttling"]; ok {
cpuThrottling = val.Bool()
}
if val, ok := annotations["autoscaling.knative.dev/minScale"]; ok {
minScale = val.Float()
}

cpu := int64(1)
if val, ok := limits["cpu"]; ok {
cpu = int64(val.Float())
}

memory := int64(536870912) // 512 MiB
if val, ok := limits["memory"]; ok {
parseMemory, err := resource.ParseQuantity(val.String())
if err == nil {
memory = parseMemory.Value() // bytes
}
}
r := &google.CloudRunService{
Address: d.Address,
Region: region,
CpuLimit: cpu,
CpuMinScale: minScale,
CpuThrottlingEnabled: cpuThrottling,
MemoryLimit: memory,
}
r.PopulateUsage(u)
return r.BuildResource()
}
16 changes: 16 additions & 0 deletions internal/providers/terraform/google/cloud_run_service_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package google_test

import (
"testing"

"github.com/infracost/infracost/internal/providers/terraform/tftest"
)

func TestCloudRunService(t *testing.T) {
t.Parallel()
if testing.Short() {
t.Skip("skipping test in short mode")
}

tftest.GoldenFileResourceTests(t, "cloud_run_service_test")
}
42 changes: 42 additions & 0 deletions internal/providers/terraform/google/cloud_run_v2_job.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package google

import (
"github.com/infracost/infracost/internal/resources/google"
"github.com/infracost/infracost/internal/schema"
"k8s.io/apimachinery/pkg/api/resource"
)

func getCloudRunV2JobRegistryItem() *schema.RegistryItem {
return &schema.RegistryItem{
Name: "google_cloud_run_v2_job",
CoreRFunc: newCloudRunV2Job,
}
}

func newCloudRunV2Job(d *schema.ResourceData) schema.CoreResource {
region := d.Get("location").String()
limits := d.Get("template.0.template.0.containers.0.resources.0.limits").Map()
taskCount := int64(1)
if !d.IsEmpty("template.0.task_count") {
taskCount = int64(d.Get("template.0.task_count").Int())
}

cpu := int64(1)
if val, ok := limits["cpu"]; ok {
cpu = int64(val.Float())
}
memory := int64(536870912) // 512 MiB
if val, ok := limits["memory"]; ok {
parseMemory, err := resource.ParseQuantity(val.String())
if err == nil {
memory = parseMemory.Value() // bytes
}
}
return &google.CloudRunV2Job{
Address: d.Address,
Region: region,
CpuLimit: cpu,
MemoryLimit: memory,
TaskCount: taskCount,
}
}
16 changes: 16 additions & 0 deletions internal/providers/terraform/google/cloud_run_v2_job_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package google_test

import (
"testing"

"github.com/infracost/infracost/internal/providers/terraform/tftest"
)

func TestCloudRunV2Job(t *testing.T) {
t.Parallel()
if testing.Short() {
t.Skip("skipping test in short mode")
}

tftest.GoldenFileResourceTests(t, "cloud_run_v2_job_test")
}
48 changes: 48 additions & 0 deletions internal/providers/terraform/google/cloud_run_v2_service.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package google

import (
"github.com/infracost/infracost/internal/resources/google"
"github.com/infracost/infracost/internal/schema"
"k8s.io/apimachinery/pkg/api/resource"
)

func getCloudRunV2ServiceRegistryItem() *schema.RegistryItem {
return &schema.RegistryItem{
Name: "google_cloud_run_v2_service",
RFunc: newCloudRunV2Service,
}
}

func newCloudRunV2Service(d *schema.ResourceData, u *schema.UsageData) *schema.Resource {
region := d.Get("location").String()
limits := d.Get("template.0.containers.0.resources.0.limits").Map()
cpu := int64(1)
if val, ok := limits["cpu"]; ok {
cpu = int64(val.Float())
}
memory := int64(536870912) // 512 MiB
if val, ok := limits["memory"]; ok {
parseMemory, err := resource.ParseQuantity(val.String())
if err == nil {
memory = parseMemory.Value() // bytes
}
}
isCpuIdle := true
if !d.IsEmpty("template.0.containers.0.resources.0.cpu_idle") {
isCpuIdle = d.Get("template.0.containers.0.resources.0.cpu_idle").Bool()
}
minInstanceCount := float64(0.5)
if !d.IsEmpty("template.0.scaling.0.min_instance_count") {
minInstanceCount = d.Get("template.0.scaling.0.min_instance_count").Float()
}
r := &google.CloudRunV2Service{
Address: d.Address,
Region: region,
CpuLimit: cpu,
MemoryLimit: memory,
IsThrottlingEnabled: isCpuIdle,
MinInstanceCount: minInstanceCount,
}
r.PopulateUsage(u)
return r.BuildResource()
}
16 changes: 16 additions & 0 deletions internal/providers/terraform/google/cloud_run_v2_service_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package google_test

import (
"testing"

"github.com/infracost/infracost/internal/providers/terraform/tftest"
)

func TestCloudRunV2Service(t *testing.T) {
t.Parallel()
if testing.Short() {
t.Skip("skipping test in short mode")
}

tftest.GoldenFileResourceTests(t, "cloud_run_v2_service_test")
}
12 changes: 8 additions & 4 deletions internal/providers/terraform/google/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ var ResourceRegistry []*schema.RegistryItem = []*schema.RegistryItem{
getStorageBucketRegistryItem(),
getComputePerInstanceConfigRegistryItem(),
getComputeRegionPerInstanceConfigRegistryItem(),
getCloudRunServiceRegistryItem(),
getCloudRunV2JobRegistryItem(),
getCloudRunV2ServiceRegistryItem(),
}

// FreeResources grouped alphabetically
Expand All @@ -75,11 +78,12 @@ var FreeResources = []string{
"google_cloudfunctions_function_iam_binding",
"google_cloudfunctions_function_iam_member",
"google_cloudfunctions_function_iam_policy",
"google_cloud_run_domain_mapping",
"google_cloud_run_service_iam_member",
"google_cloud_run_service_iam_policy",
"google_cloud_run_v2_job_iam_member",
"google_cloud_run_v2_service_iam_binding",
"google_cloud_run_service_iam_binding",
"google_cloud_run_service_iam_member",
"google_cloud_run_domain_mapping",
"google_cloud_run_v2_job_iam",
"google_cloud_run_v2_service_iam",
"google_cloudfunctions2_function_iam_policy",
"google_compute_attached_disk",
"google_compute_backend_bucket",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Name Monthly Qty Unit Monthly Cost

google_cloud_run_service.throttling_enabled
├─ CPU allocation time (tier 2) 1,800,000 vCPU-seconds $60.48
├─ Memory allocation time (tier 2) 900,000 GiB-seconds $3.15
└─ Number of requests 500,000 requests $0.20

google_cloud_run_service.throttling_disabled
├─ CPU allocation time (always-on) 1,314,000 vCPU-seconds $28.38
└─ Memory allocation time (always-on) 657,000 GiB-seconds $1.58

OVERALL TOTAL $93.79

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

──────────────────────────────────
2 cloud resources were detected:
∙ 2 were estimated

┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃ Project ┃ Baseline cost ┃ Usage cost* ┃ Total cost ┃
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━╋━━━━━━━━━━━━┫
┃ main ┃ $94 ┃ $0.00 ┃ $94 ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━┻━━━━━━━━━━━━┛
Loading

0 comments on commit bd801a6

Please sign in to comment.