From 82889a1005fb4043edaf513fa9a15b41a9acbe9b Mon Sep 17 00:00:00 2001 From: Victor Paredes Date: Fri, 19 Nov 2021 18:17:24 -0500 Subject: [PATCH 1/4] Add arn attribute to task_definition_data_source. Update test to contain arn attribute. --- internal/service/ecs/task_definition_data_source.go | 5 +++++ internal/service/ecs/task_definition_data_source_test.go | 1 + 2 files changed, 6 insertions(+) diff --git a/internal/service/ecs/task_definition_data_source.go b/internal/service/ecs/task_definition_data_source.go index 4125e12e6d2..cbaf5494ca8 100644 --- a/internal/service/ecs/task_definition_data_source.go +++ b/internal/service/ecs/task_definition_data_source.go @@ -20,6 +20,10 @@ func DataSourceTaskDefinition() *schema.Resource { Required: true, }, // Computed values. + "arn": { + Type: schema.TypeString, + Computed: true, + }, "family": { Type: schema.TypeString, Computed: true, @@ -64,6 +68,7 @@ func dataSourceTaskDefinitionRead(d *schema.ResourceData, meta interface{}) erro taskDefinition := desc.TaskDefinition d.SetId(aws.StringValue(taskDefinition.TaskDefinitionArn)) + d.Set("arn", taskDefinition.TaskDefinitionArn) d.Set("family", taskDefinition.Family) d.Set("network_mode", taskDefinition.NetworkMode) d.Set("revision", taskDefinition.Revision) diff --git a/internal/service/ecs/task_definition_data_source_test.go b/internal/service/ecs/task_definition_data_source_test.go index 6e406aa8a41..3f0c9d33d9b 100644 --- a/internal/service/ecs/task_definition_data_source_test.go +++ b/internal/service/ecs/task_definition_data_source_test.go @@ -23,6 +23,7 @@ func TestAccECSTaskDefinitionDataSource_ecsTaskDefinition(t *testing.T) { { Config: testAccCheckTaskDefinitionDataSourceConfig(rName), Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrPair(resourceName, "arn", "aws_ecs_task_definition.mongo", "arn"), resource.TestCheckResourceAttr(resourceName, "family", rName), resource.TestCheckResourceAttr(resourceName, "network_mode", "bridge"), resource.TestMatchResourceAttr(resourceName, "revision", regexp.MustCompile("^[1-9][0-9]*$")), From a874884ccf1219c59b404d7151bcabb290160244 Mon Sep 17 00:00:00 2001 From: Victor Paredes Date: Fri, 19 Nov 2021 18:29:40 -0500 Subject: [PATCH 2/4] Update docs to include arn attribute. --- website/docs/d/ecs_task_definition.html.markdown | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/website/docs/d/ecs_task_definition.html.markdown b/website/docs/d/ecs_task_definition.html.markdown index 6ff3f5e263f..8f4183d6946 100644 --- a/website/docs/d/ecs_task_definition.html.markdown +++ b/website/docs/d/ecs_task_definition.html.markdown @@ -51,7 +51,7 @@ resource "aws_ecs_service" "mongo" { desired_count = 2 # Track the latest ACTIVE revision - task_definition = "${aws_ecs_task_definition.mongo.family}:${max(aws_ecs_task_definition.mongo.revision, data.aws_ecs_task_definition.mongo.revision)}" + task_definition = aws_ecs_task_definition.mongo.arn } ``` @@ -65,6 +65,7 @@ The following arguments are supported: In addition to all arguments above, the following attributes are exported: +* `arn` - The ARN of the task definition * `family` - The family of this task definition * `network_mode` - The Docker networking mode to use for the containers in this task. * `revision` - The revision of this task definition From 4e94ec81b96e64e3f600ca26f33cf156a6486a9c Mon Sep 17 00:00:00 2001 From: Victor Paredes Date: Fri, 19 Nov 2021 18:34:18 -0500 Subject: [PATCH 3/4] Add changelog file. --- .changelog/21856.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/21856.txt diff --git a/.changelog/21856.txt b/.changelog/21856.txt new file mode 100644 index 00000000000..d5d48508fcb --- /dev/null +++ b/.changelog/21856.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +data/aws_ecs_task_definition: Add `arn` attribute. +``` \ No newline at end of file From 0b62898e9d7fe215317a30fc4d3fc8ed78f8f669 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Thu, 23 Dec 2021 08:35:42 -0500 Subject: [PATCH 4/4] Update 21856.txt --- .changelog/21856.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.changelog/21856.txt b/.changelog/21856.txt index d5d48508fcb..5f08248610c 100644 --- a/.changelog/21856.txt +++ b/.changelog/21856.txt @@ -1,3 +1,3 @@ ```release-note:enhancement -data/aws_ecs_task_definition: Add `arn` attribute. -``` \ No newline at end of file +data-source/aws_ecs_task_definition: Add `arn` attribute. +```