Skip to content

Remove Environment tag from IAM Roles - #1346

Closed
sammort wants to merge 1 commit into
github-aws-runners:developfrom
futurelearn:sm-remove-dupe-tags-in-roles
Closed

sammort wants to merge 1 commit into
github-aws-runners:developfrom
futurelearn:sm-remove-dupe-tags-in-roles

Conversation

@sammort

@sammort sammort commented Oct 27, 2021 •

Copy link
Copy Markdown

Following discussion on #1328 which would break the module's functionality, this PR takes a different approach to the issue I described in #1280.

Problem Summary

Using var.environment to tag all resources with a key named Environment is incompatible with some organization's
tagging policies. This is due to IAM Roles being case insensitive to tags, where an orgnaization is using an environment tag for all resources, the Roles cannot be created.

Behaviour

When deploying to our stack, where we include an environment tag on all resources, we encounter this problem on the IAM Roles created for each Lambda:

Error: Error creating IAM Role test-runner-action-webhook-lambda-role: InvalidInput: Duplicate tag keys found. Please note that Tag keys are case insensitive.
│ 	status code: 400, request id: 3ac70edf-d44a-4410-ada8-41c786a1593b
│
│   with module.test-github-runner.module.webhook.aws_iam_role.webhook_lambda,
│   on .terraform/modules/test-github-runner/modules/webhook/webhook.tf line 51, in resource "aws_iam_role" "webhook_lambda":
│   51: resource "aws_iam_role" "webhook_lambda" {

Proposed solution

Stop tagging IAM Roles with Environment value, this tag isn't required on IAM Roles to maintain the functionality of this module.

IAM Roles and Users have case insensitive tags. By not adding the
`Environment` tag to the IAM Roles we avoid role creation failure
where an organization are using an `environment` tag key already which
they apply to all resources
@npalm

npalm commented Nov 9, 2021

Copy link
Copy Markdown
Member

Sorry for keeping the PR open so long, but need a bit more time to see the impact.

@npalm

npalm commented Dec 25, 2021

Copy link
Copy Markdown
Member

Just a quick update, we are rethinking our model of tagging. And only enforce the few manual tags (mainly on the instances). Sorry for keep you waiting.

@ScottGuymer

Copy link
Copy Markdown
Contributor

We have moved to start using namespaced tags with a prefix of ghr: and only use them where strictly needed for the module. This is still in progress and will need ongoing work.

Other tags can be added automatically to all resources by the AWS provider using Default Tags functionality.

This should mean that we no longer need to pass tags into the module and try and merge them with internal tags etc.

@sammort

sammort commented Jan 13, 2022

Copy link
Copy Markdown
Author

Thanks both, really good to see the continued development of this module.

I'll close this PR

@sammort sammort closed this Jan 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants