Skip to content

Commit

Permalink
Creation of Cirrus Data and Payload S3 bucket if none is defined via …
Browse files Browse the repository at this point in the history
…inputs (#82)
  • Loading branch information
hectormachin authored Oct 4, 2024
1 parent f8de9ac commit 9186505
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

- Builtin lambdas added to cirrus module along with script to update deployment zip
- API Gateway infrastructure for Cirrus API
- Creation of Cirrus Data and Payload S3 bucket if none is defined via inputs

### Changed

Expand Down
4 changes: 2 additions & 2 deletions ci.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ console_ui_inputs = {
}

cirrus_inputs = {
data_bucket = "cirrus-data-bucket-name"
payload_bucket = "cirrus-payload-bucket-name"
data_bucket = "" # If left blank the deployment will create the data bucket
payload_bucket = "" # If left blank the deployment will create the payload bucket
log_level = "DEBUG"
deploy_alarms = true
custom_alarms = {
Expand Down
4 changes: 2 additions & 2 deletions default.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ console_ui_inputs = {
}

cirrus_inputs = {
data_bucket = "cirrus-data-bucket-name"
payload_bucket = "cirrus-payload-bucket-name"
data_bucket = "" # If left blank the deployment will create the data bucket
payload_bucket = "" # If left blank the deployment will create the payload bucket
log_level = "DEBUG"
deploy_alarms = true
custom_alarms = {
Expand Down
4 changes: 2 additions & 2 deletions modules/cirrus/base/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ output "cirrus_instance_profile_arn" {
}

output "cirrus_data_bucket" {
value = var.cirrus_data_bucket
value = var.cirrus_data_bucket != "" ? var.cirrus_data_bucket : aws_s3_bucket.cirrus_data_bucket[0].id
}

output "cirrus_payload_bucket" {
value = var.cirrus_payload_bucket
value = var.cirrus_payload_bucket != "" ? var.cirrus_payload_bucket : aws_s3_bucket.cirrus_payload_bucket[0].id
}
13 changes: 13 additions & 0 deletions modules/cirrus/base/s3.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
resource "aws_s3_bucket" "cirrus_data_bucket" {
count = var.cirrus_data_bucket == "" ? 1 : 0

bucket_prefix = var.cirrus_data_bucket == "" ? "${var.cirrus_prefix}-data-" : var.cirrus_data_bucket
force_destroy = true
}

resource "aws_s3_bucket" "cirrus_payload_bucket" {
count = var.cirrus_payload_bucket == "" ? 1 : 0

bucket_prefix = var.cirrus_payload_bucket == "" ? "${var.cirrus_prefix}-payload-" : var.cirrus_payload_bucket
force_destroy = true
}
4 changes: 2 additions & 2 deletions modules/cirrus/functions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ module "functions" {
vpc_security_group_ids = var.vpc_security_group_ids
cirrus_prefix = local.cirrus_prefix
cirrus_log_level = var.cirrus_log_level
cirrus_data_bucket = var.cirrus_data_bucket
cirrus_payload_bucket = var.cirrus_payload_bucket
cirrus_data_bucket = module.base-builtins.cirrus_data_bucket
cirrus_payload_bucket = module.base-builtins.cirrus_payload_bucket
cirrus_api_lambda_timeout = var.cirrus_api_lambda_timeout
cirrus_api_lambda_memory = var.cirrus_api_lambda_memory
cirrus_process_lambda_timeout = var.cirrus_process_lambda_timeout
Expand Down

0 comments on commit 9186505

Please sign in to comment.