2021-10-24 22:23:39 +00:00
|
|
|
provider "aws" {
|
|
|
|
region = var.aws_region
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_s3_bucket" "hff_entry_forms" {
|
|
|
|
bucket = var.app_root_url
|
|
|
|
acl = "log-delivery-write"
|
|
|
|
}
|
|
|
|
|
|
|
|
module "dev_env" {
|
|
|
|
source = "./deployed_env"
|
|
|
|
|
|
|
|
environment = "dev"
|
|
|
|
api_certificate_arn = var.api_certificate_arn
|
|
|
|
artifact_bucket = aws_s3_bucket.hff_entry_forms
|
|
|
|
cloudfront_certificate_arn = var.cloudfront_certificate_arn
|
|
|
|
ecr_repo = aws_ecr_repository.hff_entry_forms_api
|
2024-08-12 17:14:01 +00:00
|
|
|
target_port = 6005
|
2021-10-24 22:23:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module "prod_env" {
|
|
|
|
source = "./deployed_env"
|
|
|
|
|
|
|
|
environment = "prod"
|
|
|
|
api_certificate_arn = var.api_certificate_arn
|
|
|
|
artifact_bucket = aws_s3_bucket.hff_entry_forms
|
|
|
|
cloudfront_certificate_arn = var.cloudfront_certificate_arn
|
|
|
|
ecr_repo = aws_ecr_repository.hff_entry_forms_api
|
2024-08-12 17:14:01 +00:00
|
|
|
target_port = 6006
|
2021-10-24 22:23:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
data "aws_iam_policy_document" "cloudfront_access_policy" {
|
2024-08-12 17:14:01 +00:00
|
|
|
source_policy_documents = [
|
|
|
|
module.dev_env.oai_access_policy.json,
|
|
|
|
module.prod_env.oai_access_policy.json
|
|
|
|
]
|
2021-10-24 22:23:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_s3_bucket_policy" "hff_entry_forms" {
|
|
|
|
bucket = aws_s3_bucket.hff_entry_forms.id
|
|
|
|
policy = data.aws_iam_policy_document.cloudfront_access_policy.json
|
|
|
|
}
|