Terraform module for crazy-berlin-weather service
This module can be used to prepare AWS S3 solution for crazy-berlin-weather service. Was developed as test exercise.
How to use
Add environment variables
Bash example:
AWS_DEFAULT_REGION="<YOUR APP REGION>"
AWS_ACCESS_KEY_ID="<YOUR AWS_ACCESS_KEY_ID>"
AWS_SECRET_ACCESS_KEY="<YOUR AWS_SECRET_ACCESS_KEY>"
Fish example:
set -Ux AWS_DEFAULT_REGION <YOUR APP REGION>
set -Ux AWS_ACCESS_KEY_ID <YOUR AWS_ACCESS_KEY_ID>
set -Ux AWS_SECRET_ACCESS_KEY <YOUR AWS_SECRET_ACCESS_KEY>
Create main.tf file with:
module "weather_reports" {
source = "github.com/behoof4mind/tf-module-weather-reports?ref=0.0.2"
bucket_name_prefix = "crazy-berlin-weather"
s3_acl_type = "private"
origin_website = "https://weather-service.com"
hourly = {
suffix = "hourly"
acl_type = "private"
expiration = 90
transition_1_sc = "STANDARD_IA"
transition_1_days = 30
transition_2_sc = "GLACIER"
transition_2_days = 60
}
daily = {
suffix = "daily"
acl_type = "private"
expiration = 180
transition_1_sc = "STANDARD_IA"
transition_1_days = 30
transition_2_sc = "GLACIER"
transition_2_days = 60
}
weekly = {
suffix = "weekly"
acl_type = "private"
expiration = 360
transition_1_sc = "STANDARD_IA"
transition_1_days = 30
transition_2_sc = "GLACIER"
transition_2_days = 60
}
}
output "weekly_endpoint" {
description = "Endpoint for weekly S3 bucket"
value = module.weather_reports.weekly_endpoint
}
output "daily_endpoint" {
description = "Endpoint for daily S3 bucket"
value = module.weather_reports.daily_endpoint
}
output "hourly_endpoint" {
description = "Endpoint for hourly S3 bucket"
value = module.weather_reports.hourly_endpoint
}
- these variables in example are default, if you don't want to override them - only source line should be specified;
- dont forget to use latest varion of module in ref=0.0.2 notation
Make init
terraform init
Apply changes
terraform apply
As result, you should see output with access points like:
daily_endpoint = "crazy-berlin-weather-daily-307150142929.s3-accesspoint.us-east-2.amazonaws.com"
hourly_endpoint = "crazy-berlin-weather-hourly-307150142929.s3-accesspoint.us-east-2.amazonaws.com"
weekly_endpoint = "crazy-berlin-weather-weekly-307150142929.s3-accesspoint.us-east-2.amazonaws.com"
Contributing
Thanks for considering contributing! There’s information about how to get started with tf-module-weather-reports module
License
Copyright © 2021 Denis Lavrushko