Skip to content

Commit

Permalink
🚨 lint: Addresses lint
Browse files Browse the repository at this point in the history
  • Loading branch information
bendoerr committed Aug 20, 2024
1 parent 18e704d commit 901e895
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 80 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

TODO


## Usage

TODO
Expand Down
12 changes: 6 additions & 6 deletions examples/simple/ctx.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module "context" {
source = "bendoerr-terraform-modules/context/null"
version = "0.4.1"
namespace = var.namespace
role = "cloudfront-s3-example"
region = "us-east-1"
project = "simple"
source = "bendoerr-terraform-modules/context/null"
version = "0.4.1"
namespace = var.namespace
role = "cloudfront-s3-example"
region = "us-east-1"
project = "simple"
}
98 changes: 49 additions & 49 deletions examples/simple/infracost-usage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,59 +13,59 @@ resource_usage:
monthly_select_data_scanned_gb: 0.0 # Monthly data scanned by S3 Select in GB.
monthly_select_data_returned_gb: 0.0 # Monthly data returned by S3 Select in GB.
# intelligent_tiering:
# frequent_access_storage_gb: 0.0 # Total storage for Frequent Access Tier in GB.
# infrequent_access_storage_gb: 0.0 # Total storage for Infrequent Access Tier in GB.
# monitored_objects: 0 # Total objects monitored by the Intelligent Tiering.
# monthly_tier_1_requests: 0 # Monthly PUT, COPY, POST, LIST requests (Tier 1).
# monthly_tier_2_requests: 0 # Monthly GET, SELECT, and all other requests (Tier 2).
# monthly_lifecycle_transition_requests: 0 # Monthly Lifecycle Transition requests.
# monthly_select_data_scanned_gb: 0.0 # Monthly data scanned by S3 Select in GB.
# monthly_select_data_returned_gb: 0.0 # Monthly data returned by S3 Select in GB.
# early_delete_gb: 0.0 # If an archive is deleted within 1 months of being uploaded, you will be charged an early deletion fee per GB.
# archive_access_storage_gb: 0.0
# deep_archive_access_storage_gb: 0.0
# frequent_access_storage_gb: 0.0 # Total storage for Frequent Access Tier in GB.
# infrequent_access_storage_gb: 0.0 # Total storage for Infrequent Access Tier in GB.
# monitored_objects: 0 # Total objects monitored by the Intelligent Tiering.
# monthly_tier_1_requests: 0 # Monthly PUT, COPY, POST, LIST requests (Tier 1).
# monthly_tier_2_requests: 0 # Monthly GET, SELECT, and all other requests (Tier 2).
# monthly_lifecycle_transition_requests: 0 # Monthly Lifecycle Transition requests.
# monthly_select_data_scanned_gb: 0.0 # Monthly data scanned by S3 Select in GB.
# monthly_select_data_returned_gb: 0.0 # Monthly data returned by S3 Select in GB.
# early_delete_gb: 0.0 # If an archive is deleted within 1 months of being uploaded, you will be charged an early deletion fee per GB.
# archive_access_storage_gb: 0.0
# deep_archive_access_storage_gb: 0.0
# standard_infrequent_access:
# storage_gb: 0.0 # Total storage in GB.
# monthly_tier_1_requests: 0 # Monthly PUT, COPY, POST, LIST requests (Tier 1).
# monthly_tier_2_requests: 0 # Monthly GET, SELECT, and all other requests (Tier 2).
# monthly_lifecycle_transition_requests: 0 # Monthly Lifecycle Transition requests.
# monthly_data_retrieval_gb: 0.0 # Monthly data retrievals in GB
# monthly_select_data_scanned_gb: 0.0 # Monthly data scanned by S3 Select in GB.
# monthly_select_data_returned_gb: 0.0 # Monthly data returned by S3 Select in GB.
# storage_gb: 0.0 # Total storage in GB.
# monthly_tier_1_requests: 0 # Monthly PUT, COPY, POST, LIST requests (Tier 1).
# monthly_tier_2_requests: 0 # Monthly GET, SELECT, and all other requests (Tier 2).
# monthly_lifecycle_transition_requests: 0 # Monthly Lifecycle Transition requests.
# monthly_data_retrieval_gb: 0.0 # Monthly data retrievals in GB
# monthly_select_data_scanned_gb: 0.0 # Monthly data scanned by S3 Select in GB.
# monthly_select_data_returned_gb: 0.0 # Monthly data returned by S3 Select in GB.
# one_zone_infrequent_access:
# storage_gb: 0.0 # Total storage in GB.
# monthly_tier_1_requests: 0 # Monthly PUT, COPY, POST, LIST requests (Tier 1).
# monthly_tier_2_requests: 0 # Monthly GET, SELECT, and all other requests (Tier 2).
# monthly_lifecycle_transition_requests: 0 # Monthly Lifecycle Transition requests.
# monthly_data_retrieval_gb: 0.0 # Monthly data retrievals in GB
# monthly_select_data_scanned_gb: 0.0 # Monthly data scanned by S3 Select in GB.
# monthly_select_data_returned_gb: 0.0 # Monthly data returned by S3 Select in GB.
# storage_gb: 0.0 # Total storage in GB.
# monthly_tier_1_requests: 0 # Monthly PUT, COPY, POST, LIST requests (Tier 1).
# monthly_tier_2_requests: 0 # Monthly GET, SELECT, and all other requests (Tier 2).
# monthly_lifecycle_transition_requests: 0 # Monthly Lifecycle Transition requests.
# monthly_data_retrieval_gb: 0.0 # Monthly data retrievals in GB
# monthly_select_data_scanned_gb: 0.0 # Monthly data scanned by S3 Select in GB.
# monthly_select_data_returned_gb: 0.0 # Monthly data returned by S3 Select in GB.
# glacier_flexible_retrieval:
# storage_gb: 0 # Total storage in GB.
# monthly_tier_1_requests: 0 # Monthly PUT, COPY, POST, LIST requests (Tier 1).
# monthly_tier_2_requests: 0 # Monthly GET, SELECT, and all other requests (Tier 2).
# monthly_lifecycle_transition_requests: 0 # Monthly Lifecycle Transition requests.
# monthly_standard_select_data_scanned_gb: 0.0 # Monthly data scanned by S3 Select in GB (for standard level of S3 Glacier).
# monthly_standard_select_data_returned_gb: 0.0 # Monthly data returned by S3 Select in GB (for standard level of S3 Glacier).
# monthly_bulk_select_data_scanned_gb: 0.0 # Monthly data scanned by S3 Select in GB (for bulk level of S3 Glacier)
# monthly_bulk_select_data_returned_gb: 0.0 # Monthly data returned by S3 Select in GB (for bulk level of S3 Glacier)
# monthly_expedited_select_data_scanned_gb: 0.0 # Monthly data scanned by S3 Select in GB (for expedited level of S3 Glacier)
# monthly_expedited_select_data_returned_gb: 0.0 # Monthly data returned by S3 Select in GB (for expedited level of S3 Glacier)
# monthly_standard_data_retrieval_requests: 0 # Monthly data Retrieval requests (for standard level of S3 Glacier).
# monthly_expedited_data_retrieval_requests: 0 # Monthly data Retrieval requests (for expedited level of S3 Glacier).
# monthly_standard_data_retrieval_gb: 0.0 # Monthly data retrievals in GB (for standard level of S3 Glacier).
# monthly_expedited_data_retrieval_gb: 0.0 # Monthly data retrievals in GB (for expedited level of S3 Glacier).
# early_delete_gb: 0.0 # If an archive is deleted within 3 months of being uploaded, you will be charged an early deletion fee per GB.
# storage_gb: 0 # Total storage in GB.
# monthly_tier_1_requests: 0 # Monthly PUT, COPY, POST, LIST requests (Tier 1).
# monthly_tier_2_requests: 0 # Monthly GET, SELECT, and all other requests (Tier 2).
# monthly_lifecycle_transition_requests: 0 # Monthly Lifecycle Transition requests.
# monthly_standard_select_data_scanned_gb: 0.0 # Monthly data scanned by S3 Select in GB (for standard level of S3 Glacier).
# monthly_standard_select_data_returned_gb: 0.0 # Monthly data returned by S3 Select in GB (for standard level of S3 Glacier).
# monthly_bulk_select_data_scanned_gb: 0.0 # Monthly data scanned by S3 Select in GB (for bulk level of S3 Glacier)
# monthly_bulk_select_data_returned_gb: 0.0 # Monthly data returned by S3 Select in GB (for bulk level of S3 Glacier)
# monthly_expedited_select_data_scanned_gb: 0.0 # Monthly data scanned by S3 Select in GB (for expedited level of S3 Glacier)
# monthly_expedited_select_data_returned_gb: 0.0 # Monthly data returned by S3 Select in GB (for expedited level of S3 Glacier)
# monthly_standard_data_retrieval_requests: 0 # Monthly data Retrieval requests (for standard level of S3 Glacier).
# monthly_expedited_data_retrieval_requests: 0 # Monthly data Retrieval requests (for expedited level of S3 Glacier).
# monthly_standard_data_retrieval_gb: 0.0 # Monthly data retrievals in GB (for standard level of S3 Glacier).
# monthly_expedited_data_retrieval_gb: 0.0 # Monthly data retrievals in GB (for expedited level of S3 Glacier).
# early_delete_gb: 0.0 # If an archive is deleted within 3 months of being uploaded, you will be charged an early deletion fee per GB.
# glacier_deep_archive:
# storage_gb: 0.0 # Total storage in GB.
# monthly_tier_1_requests: 0 # Monthly PUT, COPY, POST, LIST requests (Tier 1).
# monthly_tier_2_requests: 0 # Monthly GET, SELECT, and all other requests (Tier 2).
# monthly_lifecycle_transition_requests: 0 # Monthly Lifecycle Transition requests.
# monthly_standard_data_retrieval_requests: 0 # Monthly data Retrieval requests (for standard level of S3 Glacier).
# monthly_bulk_data_retrieval_requests: 0 # Monthly data Retrieval requests (for bulk level of S3 Glacier).
# monthly_standard_data_retrieval_gb: 0.0 # Monthly data retrievals in GB (for standard level of S3 Glacier).
# monthly_bulk_data_retrieval_gb: 0.0 # Monthly data retrievals in GB (for bulk level of S3 Glacier).
# early_delete_gb: 0.0 # If an archive is deleted within 6 months of being uploaded, you will be charged an early deletion fee per GB.
# storage_gb: 0.0 # Total storage in GB.
# monthly_tier_1_requests: 0 # Monthly PUT, COPY, POST, LIST requests (Tier 1).
# monthly_tier_2_requests: 0 # Monthly GET, SELECT, and all other requests (Tier 2).
# monthly_lifecycle_transition_requests: 0 # Monthly Lifecycle Transition requests.
# monthly_standard_data_retrieval_requests: 0 # Monthly data Retrieval requests (for standard level of S3 Glacier).
# monthly_bulk_data_retrieval_requests: 0 # Monthly data Retrieval requests (for bulk level of S3 Glacier).
# monthly_standard_data_retrieval_gb: 0.0 # Monthly data retrievals in GB (for standard level of S3 Glacier).
# monthly_bulk_data_retrieval_gb: 0.0 # Monthly data retrievals in GB (for bulk level of S3 Glacier).
# early_delete_gb: 0.0 # If an archive is deleted within 6 months of being uploaded, you will be charged an early deletion fee per GB.
module.cloudfront_with_s3_origin.aws_cloudfront_distribution.site:
monthly_data_transfer_to_internet_gb:
us: 0.1 # United States, Mexico, Canada
Expand Down
15 changes: 10 additions & 5 deletions examples/simple/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
output "s3_bucket_id" {
value = module.cloudfront_with_s3_origin.s3_bucket_id
value = module.cloudfront_with_s3_origin.s3_bucket_id
description = "TODO"
}

output "s3_bucket_arn" {
value = module.cloudfront_with_s3_origin.s3_bucket_arn
value = module.cloudfront_with_s3_origin.s3_bucket_arn
description = "TODO"
}

output "cloudfront_distribution_id" {
value = module.cloudfront_with_s3_origin.cloudfront_distribution_id
value = module.cloudfront_with_s3_origin.cloudfront_distribution_id
description = "TODO"
}

output "cloudfront_distribution_arn" {
value = module.cloudfront_with_s3_origin.cloudfront_distribution_arn
value = module.cloudfront_with_s3_origin.cloudfront_distribution_arn
description = "TODO"
}

output "cloudfront_distribution_domain_name" {
value = module.cloudfront_with_s3_origin.cloudfront_distribution_domain_name
value = module.cloudfront_with_s3_origin.cloudfront_distribution_domain_name
description = "TODO"
}
15 changes: 10 additions & 5 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
output "s3_bucket_id" {
value = module.s3_site.s3_bucket_id
value = module.s3_site.s3_bucket_id
description = "TODO"
}

output "s3_bucket_arn" {
value = module.s3_site.s3_bucket_arn
value = module.s3_site.s3_bucket_arn
description = "TODO"
}

output "cloudfront_distribution_id" {
value = aws_cloudfront_distribution.site.id
value = aws_cloudfront_distribution.site.id
description = "TODO"
}

output "cloudfront_distribution_arn" {
value = aws_cloudfront_distribution.site.arn
value = aws_cloudfront_distribution.site.arn
description = "TODO"
}

output "cloudfront_distribution_domain_name" {
value = aws_cloudfront_distribution.site.domain_name
value = aws_cloudfront_distribution.site.domain_name
description = "TODO"
}
29 changes: 15 additions & 14 deletions test/examples_simple_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ package test_test
import (
"context"
"fmt"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/cloudfront"
"github.com/gruntwork-io/terratest/modules/random"
"io"
"net/http"
"os"
"strings"
"testing"
"time"

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/cloudfront"
"github.com/gruntwork-io/terratest/modules/random"

"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/s3"
"github.com/gruntwork-io/terratest/modules/terraform"
Expand Down Expand Up @@ -57,15 +58,15 @@ func TestDefaults(t *testing.T) {

// Upload two test files to the S3 bucket
s3Client := s3.NewFromConfig(cfg)
bucketId := terraform.Output(t, terraformOptions, "s3_bucket_id")
bucketID := terraform.Output(t, terraformOptions, "s3_bucket_id")

indexTxt := random.UniqueId()
testTxt := random.UniqueId()

_, err = s3Client.PutObject(
context.Background(),
&s3.PutObjectInput{
Bucket: aws.String(bucketId),
Bucket: aws.String(bucketID),
Key: aws.String("index.html"),
Body: strings.NewReader(indexTxt),
},
Expand All @@ -74,7 +75,7 @@ func TestDefaults(t *testing.T) {
_, _ = s3Client.DeleteObject(
context.Background(),
&s3.DeleteObjectInput{
Bucket: aws.String(bucketId),
Bucket: aws.String(bucketID),
Key: aws.String("index.html"),
})
t.Log("deleted index.html")
Expand All @@ -86,7 +87,7 @@ func TestDefaults(t *testing.T) {
_, err = s3Client.PutObject(
context.Background(),
&s3.PutObjectInput{
Bucket: aws.String(bucketId),
Bucket: aws.String(bucketID),
Key: aws.String("test.txt"),
Body: strings.NewReader(testTxt),
},
Expand All @@ -95,7 +96,7 @@ func TestDefaults(t *testing.T) {
_, _ = s3Client.DeleteObject(
context.Background(),
&s3.DeleteObjectInput{
Bucket: aws.String(bucketId),
Bucket: aws.String(bucketID),
Key: aws.String("test.txt"),
})
t.Log("deleted test.txt")
Expand All @@ -106,17 +107,17 @@ func TestDefaults(t *testing.T) {

// Ensure that the distribution is ready
cloudfrontClient := cloudfront.NewFromConfig(cfg)
cloudfrontId := terraform.Output(t, terraformOptions, "cloudfront_distribution_id")
cloudfrontID := terraform.Output(t, terraformOptions, "cloudfront_distribution_id")

ready := false

// Wait 10 Minutes max
for wait := 0; wait < 60; wait++ {
output, err := cloudfrontClient.GetDistribution(context.Background(), &cloudfront.GetDistributionInput{
Id: aws.String(cloudfrontId),
output, lerr := cloudfrontClient.GetDistribution(context.Background(), &cloudfront.GetDistributionInput{
Id: aws.String(cloudfrontID),
})
if err != nil {
t.Fatal(err)
if lerr != nil {
t.Fatal(lerr)
}

t.Log("Current distribution status: " + *output.Distribution.Status)
Expand Down Expand Up @@ -175,7 +176,7 @@ func makediff(want interface{}, got interface{}) string {
s := fmt.Sprintf("\nwant: %# v", pretty.Formatter(want))
s = fmt.Sprintf("%s\ngot: %# v", s, pretty.Formatter(got))
diffs := pretty.Diff(want, got)
s = fmt.Sprintf("%s\ndifferences: ", s)
s += "\ndifferences: "
for _, d := range diffs {
s = fmt.Sprintf("%s\n - %s", s, d)
}
Expand Down

0 comments on commit 901e895

Please sign in to comment.