File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -60,7 +60,9 @@ resource "aws_iam_role_policy" "describe_tags" {
6060resource "aws_iam_role_policy" "create_tag" {
6161 name = " runner-create-tags"
6262 role = aws_iam_role. runner . name
63- policy = templatefile (" ${ path . module } /policies/instance-create-tags-policy.json" , {})
63+ policy = templatefile (" ${ path . module } /policies/instance-create-tags-policy.json" , {
64+ ec2_custom_allowed_tags = var.ec2_custom_allowed_tags
65+ })
6466}
6567
6668resource "aws_iam_role_policy_attachment" "managed_policies" {
Original file line number Diff line number Diff line change 55 "Action" : " ec2:CreateTags" ,
66 "Condition" : {
77 "ForAllValues:StringEquals" : {
8- "aws:TagKeys" : [
9- " ghr:github_runner_id"
10- ]
8+ "aws:TagKeys" : ${jsonencode(concat(["ghr:github_runner_id"], ec2_custom_allowed_tags)) }
119 },
1210 "StringEquals" : {
1311 "aws:ARN" : " $${ec2:SourceInstanceARN}"
Original file line number Diff line number Diff line change @@ -761,3 +761,9 @@ variable "user_agent" {
761761 type = string
762762 default = null
763763}
764+
765+ variable "ec2_custom_allowed_tags" {
766+ description = " Allows the EC2 instance to create tags listed here."
767+ type = list (string )
768+ default = []
769+ }
You can’t perform that action at this time.
0 commit comments