Skip to content

Commit 3450b4d

Browse files
committed
feat: Add tags to aws_iam_policy (#318)
1 parent 638ce6c commit 3450b4d

File tree

8 files changed

+22
-16
lines changed

8 files changed

+22
-16
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,13 @@ terraform destroy
245245
| Name | Version |
246246
|------|---------|
247247
| terraform | >= 0.12 |
248+
| aws | >= 3.35.0 |
248249

249250
## Providers
250251

251252
| Name | Version |
252253
|------|---------|
253-
| aws | n/a |
254+
| aws | >= 3.35.0 |
254255
| null | n/a |
255256

256257
## Modules

examples/runner-default/versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = "~> 3.23"
7+
version = "~> 3.35"
88
}
99
local = {
1010
source = "hashicorp/local"

examples/runner-docker/versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = "~> 3.23"
7+
version = "~> 3.35"
88
}
99
local = {
1010
source = "hashicorp/local"

examples/runner-pre-registered/versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = "~> 3.23"
7+
version = "~> 3.35"
88
}
99
local = {
1010
source = "hashicorp/local"

examples/runner-public/versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = "~> 3.23"
7+
version = "~> 3.35"
88
}
99
local = {
1010
source = "hashicorp/local"

main.tf

+13-10
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ resource "aws_iam_role" "instance" {
266266
name = "${var.environment}-instance-role"
267267
assume_role_policy = length(var.instance_role_json) > 0 ? var.instance_role_json : templatefile("${path.module}/policies/instance-role-trust-policy.json", {})
268268
permissions_boundary = var.permissions_boundary == "" ? null : "${var.arn_format}:iam::${data.aws_caller_identity.current.account_id}:policy/${var.permissions_boundary}"
269+
tags = local.tags
269270
}
270271

271272
################################################################################
@@ -275,8 +276,8 @@ resource "aws_iam_policy" "instance_docker_machine_policy" {
275276
name = "${var.environment}-docker-machine"
276277
path = "/"
277278
description = "Policy for docker machine."
278-
279-
policy = templatefile("${path.module}/policies/instance-docker-machine-policy.json", {})
279+
policy = templatefile("${path.module}/policies/instance-docker-machine-policy.json", {})
280+
tags = local.tags
280281
}
281282

282283
resource "aws_iam_role_policy_attachment" "instance_docker_machine_policy" {
@@ -293,8 +294,8 @@ resource "aws_iam_policy" "instance_session_manager_policy" {
293294
name = "${var.environment}-session-manager"
294295
path = "/"
295296
description = "Policy session manager."
296-
297-
policy = templatefile("${path.module}/policies/instance-session-manager-policy.json", {})
297+
policy = templatefile("${path.module}/policies/instance-session-manager-policy.json", {})
298+
tags = local.tags
298299
}
299300

300301
resource "aws_iam_role_policy_attachment" "instance_session_manager_policy" {
@@ -336,11 +337,13 @@ resource "aws_iam_role" "docker_machine" {
336337
name = "${var.environment}-docker-machine-role"
337338
assume_role_policy = length(var.docker_machine_role_json) > 0 ? var.docker_machine_role_json : templatefile("${path.module}/policies/instance-role-trust-policy.json", {})
338339
permissions_boundary = var.permissions_boundary == "" ? null : "${var.arn_format}:iam::${data.aws_caller_identity.current.account_id}:policy/${var.permissions_boundary}"
340+
tags = local.tags
339341
}
340342

341343
resource "aws_iam_instance_profile" "docker_machine" {
342344
name = "${var.environment}-docker-machine-profile"
343345
role = aws_iam_role.docker_machine.name
346+
tags = local.tags
344347
}
345348

346349
################################################################################
@@ -369,8 +372,8 @@ resource "aws_iam_policy" "service_linked_role" {
369372
name = "${var.environment}-service_linked_role"
370373
path = "/"
371374
description = "Policy for creation of service linked roles."
372-
373-
policy = templatefile("${path.module}/policies/service-linked-role-create-policy.json", { arn_format = var.arn_format })
375+
policy = templatefile("${path.module}/policies/service-linked-role-create-policy.json", { arn_format = var.arn_format })
376+
tags = local.tags
374377
}
375378

376379
resource "aws_iam_role_policy_attachment" "service_linked_role" {
@@ -393,8 +396,8 @@ resource "aws_iam_policy" "ssm" {
393396
name = "${var.environment}-ssm"
394397
path = "/"
395398
description = "Policy for runner token param access via SSM"
396-
397-
policy = templatefile("${path.module}/policies/instance-secure-parameter-role-policy.json", { arn_format = var.arn_format })
399+
policy = templatefile("${path.module}/policies/instance-secure-parameter-role-policy.json", { arn_format = var.arn_format })
400+
tags = local.tags
398401
}
399402

400403
resource "aws_iam_role_policy_attachment" "ssm" {
@@ -413,8 +416,8 @@ resource "aws_iam_policy" "eip" {
413416
name = "${var.environment}-eip"
414417
path = "/"
415418
description = "Policy for runner to assign EIP"
416-
417-
policy = templatefile("${path.module}/policies/instance-eip.json", {})
419+
policy = templatefile("${path.module}/policies/instance-eip.json", {})
420+
tags = local.tags
418421
}
419422

420423
resource "aws_iam_role_policy_attachment" "eip" {

modules/cache/main.tf

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ resource "aws_iam_policy" "docker_machine_cache" {
7979
name = "${var.environment}-docker-machine-cache"
8080
path = "/"
8181
description = "Policy for docker machine instance to access cache"
82+
tags = local.tags
8283

8384
policy = templatefile("${path.module}/policies/cache.json",
8485
{

versions.tf

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ terraform {
33
required_version = ">= 0.12"
44
required_providers {
55
aws = {
6-
source = "hashicorp/aws"
6+
version = ">= 3.35.0"
7+
source = "hashicorp/aws"
78
}
89
null = {
910
source = "hashicorp/null"

0 commit comments

Comments
 (0)