Skip to content

Commit

Permalink
Fix YAML encode calls (#381)
Browse files Browse the repository at this point in the history
  • Loading branch information
devsjc authored Jan 5, 2024
1 parent a39cdd8 commit 292d1ec
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion terraform/modules/services/eb_app/eb.tf
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,6 @@ resource "aws_elastic_beanstalk_application_version" "latest" {
name = "${var.aws-environment}-${var.eb-app_name}-${var.eb-app_type}-${var.container-tag}"
application = aws_elastic_beanstalk_application.eb-application.name
description = "Application version created by terraform (${var.container-tag})"
bucket = aws_s3_bucket.compose-bucket.id
bucket = aws_s3_bucket.eb-app-docker-bucket.id
key = aws_s3_object.eb-object.id
}
24 changes: 12 additions & 12 deletions terraform/modules/services/eb_app/s3.tf
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
# Create an S3 bucket containing the docker-compose.yml file
# for the Elastic Beanstalk app

resource "aws_s3_bucket" "compose-bucket" {
resource "aws_s3_bucket" "eb-app-docker-bucket" {
bucket = "${var.aws-environment}-eb-${var.eb-app_name}-${var.eb-app_type}"
}

resource "aws_s3_object" "eb-object" {
bucket = aws_s3_bucket.compose-bucket.id
bucket = aws_s3_bucket.eb-app-docker-bucket.id
key = "beanstalk/docker-compose-${var.container-tag}.yml"
content = yamlencode({
version: "3",
services: {
eb-app : {
image : "${var.container-registry}/openclimatefix/${var.container-name}:${var.container-tag}",
environment : [for kv in var.container-env_vars : format("%s: %s", kv.name, kv.value)],
container_name : (var.container-name),
command : (var.container-command),
ports : ["80:80"],
}
"version" = "3",
"services" = {
"eb-app" = yamlencode({
"image" = "${var.container-registry}/openclimatefix/${var.container-name}:${var.container-tag}",
"environment" = [for kv in var.container-env_vars : format("%s: %s", kv.name, kv.value)],
"container_name" = (var.container-name),
"command" = (var.container-command),
"ports" = ["80:80"],
})
}
})
}

resource "aws_s3_bucket_public_access_block" "eb-s3-pab" {
bucket = aws_s3_bucket.compose-bucket.id
bucket = aws_s3_bucket.eb-app-docker-bucket.id

block_public_acls = true
block_public_policy = true
Expand Down

0 comments on commit 292d1ec

Please sign in to comment.