Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting 'Network egress' on 'google_storage_bucket' to zero #2773

Open
tucared opened this issue Dec 2, 2023 · 1 comment
Open

Setting 'Network egress' on 'google_storage_bucket' to zero #2773

tucared opened this issue Dec 2, 2023 · 1 comment
Labels
bug Something isn't working google Issue related to Google Cloud

Comments

@tucared
Copy link

tucared commented Dec 2, 2023

Hi team,

I would like to submit a suggestion regarding how to handle the Network egress section from the google_storage_bucket ressource: being able to set it to zero.

Currently

Given

  • This main.tf file:

    resource "random_id" "bucket_prefix" {
      byte_length = 8
    }
    
    resource "google_storage_bucket" "this" {
      name     = "${random_id.bucket_prefix.hex}-bucket-name"
      location = var.region
    }
  • This variables.tf file:

    variable "region" {
      description = "Default region for creating resources"
      type        = string
      default     = "europe-west9"
    }
  • This terraform.tfvars file:

    region = "europe-west9"
  • This infracost-usage.yml file:

      google_storage_bucket.this:
        storage_gb: 1.5
        monthly_class_a_operations: 2500
        monthly_class_b_operations: 4000
        monthly_data_retrieval_gb: 3750
        monthly_egress_data_transfer_gb:
          same_continent: 0
          worldwide: 0
          asia: 0
          china: 0
          australia: 0

When

I call infracost:

infracost breakdown --path=. \
    --usage-file=infracost-usage.yml \
    --terraform-var-file=terraform.tfvars

Then

I get the following estimate:

 Name                                                                                     Monthly Qty  Unit                      Monthly Cost 
 google_storage_bucket.this                                                                                                                   
 ├─ Storage (standard)                                                                            1.5  GiB                              $0.03 
 ├─ Object adds, bucket/object list (class A)                                                    0.25  10k operations                   $0.01 
 ├─ Object gets, retrieve bucket/object metadata (class B)                                        0.4  10k operations                   $0.00 
 └─ Network egress                                                                                                                            
    ├─ Data transfer to worldwide excluding Asia, Australia (first 1TB)            Monthly cost depends on usage: $0.12 per GB                
    ├─ Data transfer to Asia excluding China, but including Hong Kong (first 1TB)  Monthly cost depends on usage: $0.12 per GB                
    ├─ Data transfer to China excluding Hong Kong (first 1TB)                      Monthly cost depends on usage: $0.23 per GB                
    └─ Data transfer to Australia (first 1TB)                                      Monthly cost depends on usage: $0.19 per GB                

We note that Data transfer in same continent item is missing, this behaviour seems to occur to the first item set to 0 in Network egress section of the infracost-usage.yml file.

Suggestion

Since I specified there is no network egress in my usage file, I suggest the output looks as followed:

 Name                                                                                     Monthly Qty  Unit                      Monthly Cost 
 google_storage_bucket.this                                                                                                                   
 ├─ Storage (standard)                                                                            1.5  GiB                              $0.03 
 ├─ Object adds, bucket/object list (class A)                                                    0.25  10k operations                   $0.01 
 ├─ Object gets, retrieve bucket/object metadata (class B)                                        0.4  10k operations                   $0.00 
 └─ Network egress      
    ├─ Data transfer in same continent                                                         0.0000  GiB                              $0.00 
    ├─ Data transfer to worldwide excluding Asia, Australia (first 1TB)                        0.0000  GiB                              $0.00              
    ├─ Data transfer to Asia excluding China, but including Hong Kong (first 1TB)              0.0000  GiB                              $0.00 
    ├─ Data transfer to China excluding Hong Kong (first 1TB)                                  0.0000  GiB                              $0.00       
    └─ Data transfer to Australia (first 1TB)                                                  0.0000  GiB                              $0.00       

or as followed:

 Name                                                                                     Monthly Qty  Unit                      Monthly Cost 
 google_storage_bucket.this                                                                                                                   
 ├─ Storage (standard)                                                                            1.5  GiB                              $0.03 
 ├─ Object adds, bucket/object list (class A)                                                    0.25  10k operations                   $0.01 
 └─ Object gets, retrieve bucket/object metadata (class B)                                        0.4  10k operations                   $0.00
@aliscott aliscott added google Issue related to Google Cloud bug Something isn't working labels Dec 4, 2023
@aliscott
Copy link
Member

aliscott commented Dec 4, 2023

@tucared thanks for reporting this. This looks like a bug to me. I would expect it to show the following:

Name                                                                                     Monthly Qty  Unit                      Monthly Cost 
 google_storage_bucket.this                                                                                                                   
 ├─ Storage (standard)                                                                            1.5  GiB                              $0.03 
 ├─ Object adds, bucket/object list (class A)                                                    0.25  10k operations                   $0.01 
 └─ Object gets, retrieve bucket/object metadata (class B)                                        0.4  10k operations                   $0.00

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working google Issue related to Google Cloud
Projects
None yet
Development

No branches or pull requests

2 participants