Skip to content

Commit

Permalink
Merge pull request #34402 from jtyrus/f-aws_ecs_task_execution-add-cl…
Browse files Browse the repository at this point in the history
…ient-token

Added ClientToken to ECS Task Execution Data Source
  • Loading branch information
ewbankkit authored Feb 12, 2024
2 parents 34fb0e8 + 0ba4c7b commit c6de339
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/34402.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
data-source/aws_ecs_task_execution: Add `client_token` argument
```
7 changes: 7 additions & 0 deletions internal/service/ecs/task_execution_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ func DataSourceTaskExecution() *schema.Resource {
},
},
},
"client_token": {
Type: schema.TypeString,
Optional: true,
},
"cluster": {
Type: schema.TypeString,
Required: true,
Expand Down Expand Up @@ -295,6 +299,9 @@ func dataSourceTaskExecutionRead(ctx context.Context, d *schema.ResourceData, me
if v, ok := d.GetOk("capacity_provider_strategy"); ok {
input.CapacityProviderStrategy = expandCapacityProviderStrategy(v.(*schema.Set))
}
if v, ok := d.GetOk("client_token"); ok {
input.ClientToken = aws.String(v.(string))
}
if v, ok := d.GetOk("desired_count"); ok {
input.Count = aws.Int64(int64(v.(int)))
}
Expand Down
2 changes: 2 additions & 0 deletions internal/service/ecs/task_execution_data_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func TestAccECSTaskExecutionDataSource_basic(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrPair(dataSourceName, "cluster", clusterName, "id"),
resource.TestCheckResourceAttrPair(dataSourceName, "task_definition", taskDefinitionName, "arn"),
resource.TestCheckResourceAttr(dataSourceName, "client_token", "some_token"),
resource.TestCheckResourceAttr(dataSourceName, "desired_count", "1"),
resource.TestCheckResourceAttr(dataSourceName, "launch_type", "FARGATE"),
resource.TestCheckResourceAttr(dataSourceName, "network_configuration.#", "1"),
Expand Down Expand Up @@ -186,6 +187,7 @@ data "aws_ecs_task_execution" "test" {
cluster = aws_ecs_cluster.test.id
task_definition = aws_ecs_task_definition.test.arn
client_token = "some_token"
desired_count = 1
launch_type = "FARGATE"
Expand Down
1 change: 1 addition & 0 deletions website/docs/d/ecs_task_execution.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ The following arguments are required:
The following arguments are optional:

* `capacity_provider_strategy` - (Optional) Set of capacity provider strategies to use for the cluster. See below.
* `client_token` - (Optional) An identifier that you provide to ensure the idempotency of the request. It must be unique and is case sensitive. Up to 64 characters are allowed. The valid characters are characters in the range of 33-126, inclusive. For more information, see [Ensuring idempotency](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/ECS_Idempotency.html).
* `desired_count` - (Optional) Number of instantiations of the specified task to place on your cluster. You can specify up to 10 tasks for each call.
* `enable_ecs_managed_tags` - (Optional) Specifies whether to enable Amazon ECS managed tags for the tasks within the service.
* `enable_execute_command` - (Optional) Specifies whether to enable Amazon ECS Exec for the tasks within the service.
Expand Down

0 comments on commit c6de339

Please sign in to comment.