Skip to content

Commit

Permalink
Add tag_resources pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
cbruno10 committed Oct 17, 2023
1 parent 0595d90 commit 39c2343
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions pipelines/tagging/tag_resources.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
pipeline "tag_resources" {
title = "Tag Resources"

param "region" {
type = string
description = "The name of the Region."
default = var.region
}

param "access_key_id" {
type = string
description = "The ID for this access key."
default = var.access_key_id
}

param "secret_access_key" {
type = string
description = "The secret key used to sign requests."
default = var.secret_access_key
}

param "resource_arns" {
type = list(string)
description = "Specifies the list of ARNs of the resources that you want to apply tags to."
}

param "tags" {
type = map(string)
description = "Specifies a list of tags that you want to add to the specified resources. A tag consists of a key and a value that you define."
}

step "container" "tag_resources" {
image = "amazon/aws-cli"

cmd = concat(
["resourcegroupstaggingapi", "tag-resources", "--resource-arn-list"],
param.resource_arns,
["--tags"],
[join(",", [for key, value in param.tags: "${key}=${value}"])]
)

env = {
AWS_REGION = param.region
AWS_ACCESS_KEY_ID = param.access_key_id
AWS_SECRET_ACCESS_KEY = param.secret_access_key
}
}

output "stdout" {
value = step.container.tag_resources.stdout
}

output "stderr" {
value = step.container.tag_resources.stderr
}
}

0 comments on commit 39c2343

Please sign in to comment.