aboutsummaryrefslogtreecommitdiffstats
path: root/fdio.infra.terraform/terraform-aws-elastic-beanstalk-application-version/main.tf
blob: ace3aebbbc2a3b80b93bbc5dc5da0f29fa7e9abb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
locals {
  key = "${var.application_name_version}-${uuid()}.zip"
  tags = {
    "Name"        = "${var.application_name}"
    "Environment" = "${var.application_name}"
  }
}

# Create elastic beanstalk Application Version
# resource "aws_s3_bucket" "bucket" {
#   bucket = var.application_bucket
#   tags   = local.tags
# }
resource "aws_s3_object" "object" {
  bucket = var.application_bucket
  key    = local.key
  source = var.application_source
  tags   = local.tags
}

resource "aws_elastic_beanstalk_application_version" "application_version" {
  application = var.application_name
  description = var.application_description
  bucket      = var.application_bucket
  key         = aws_s3_object.object.id
  name        = var.application_name_version
  tags        = local.tags
}