Skip to content

Commit

Permalink
Merge pull request #6 from danhigham/use_templatefile
Browse files Browse the repository at this point in the history
Remove deprecated template_file data object
  • Loading branch information
achandras authored Aug 9, 2022
2 parents 4ba888b + 0e04d65 commit ed08803
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 19 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ No requirements.
| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 3.61.0 |
| <a name="provider_template"></a> [template](#provider\_template) | 2.2.0 |

## Modules

Expand All @@ -64,7 +63,6 @@ No modules.
| [aws_security_group_rule.orchestrator_agent_egress_rule](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) | resource |
| [aws_security_group_rule.orchestrator_agent_ingress_rule](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) | resource |
| [aws_region.current_region](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |
| [template_file.orchestrator_agent_container_definitions](https://registry.terraform.io/providers/hashicorp/template/latest/docs/data-sources/file) | data source |

## Inputs

Expand Down
16 changes: 0 additions & 16 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,4 @@ resource "aws_cloudwatch_log_group" "orchestrator_agent" {
tags = merge(var.tags, var.default_tags)
}

data "template_file" "orchestrator_agent_container_definitions" {
template = file("${path.module}/container-definitions/orchestrator-agent.json")

vars = {
agent_image = var.agent_image
access_key = var.access_key
collector_host = var.collector_host
collector_port = var.collector_port
agent_tags = var.agent_tags
check_certificate = var.check_collector_certificate
orchestrator_port = var.orchestrator_port
awslogs_region = data.aws_region.current_region.name
awslogs_group = "${var.name}-logs"
}
}

data "aws_region" "current_region" {}
13 changes: 12 additions & 1 deletion task.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,18 @@ resource "aws_ecs_task_definition" "orchestrator_agent" {
requires_compatibilities = ["FARGATE"]
cpu = "2048"
memory = "8192"
container_definitions = data.template_file.orchestrator_agent_container_definitions.rendered

container_definitions = templatefile("${path.module}/container-definitions/orchestrator-agent.json", {
agent_image = var.agent_image
access_key = var.access_key
collector_host = var.collector_host
collector_port = var.collector_port
agent_tags = var.agent_tags
check_certificate = var.check_collector_certificate
orchestrator_port = var.orchestrator_port
awslogs_region = data.aws_region.current_region.name
awslogs_group = "${var.name}-logs"
})

tags = merge(var.tags, var.default_tags)
}

0 comments on commit ed08803

Please sign in to comment.