Skip to content

Adding Environment tag to resources configurable - #1328

Closed
sammort wants to merge 2 commits into
github-aws-runners:developfrom
futurelearn:sm-environment-tag-toggle
Closed

sammort wants to merge 2 commits into
github-aws-runners:developfrom
futurelearn:sm-environment-tag-toggle

Conversation

@sammort

@sammort sammort commented Oct 25, 2021 •

Copy link
Copy Markdown

Following discussion in #1280 here's an implementation of my suggested fix/workaround to make adding a tag for all resources with the key Environment conditional

Summary

Using var.environment to tag all resources with a key named Environment is incompatible with some organization's
tagging policies.

Proposed solution

Add the tag_with_environment_var boolean variable to indicate whether the var.environment value should be added to created resources. By default this is set to true for less disruption when updating the module.

Using var.environemnt to tag all resources with a key named
`Environment` is incompatible with some organization's
tagging policies.

Added the tag_with_environment_var boolean variable to add
this tag to resources conditionally. By default this is set
to true for less disruption when updating the module
Only create the AWS Resource Group based on the Enviornment tag if
we are applying that tag to all resources. Otherwise the Resource Group will
be empty
@npalm

npalm commented Oct 25, 2021 •

Copy link
Copy Markdown
Member

@samuelb thanks taking the time to propose a PR.

Simply disable the tag is not so straightforward since lambda and installation logic is depending on the tag. I would prefer an opation so we can set the key of the tag. I have added comment to #1280 as well

@sammort

sammort commented Oct 26, 2021 •

Copy link
Copy Markdown
Author

Ahh that's a shame.

I'm no great dev, but it looks to me as if the only place where the functions are using the Environment tag is in the listEC2Runners function within runners.ts

Is your proposal that the tag key is made configurable within the Terraform code? If so, would it be correct to say that what needs doing is putting the configured tag key value in the parameter store and fetching that in the Lambda to be used when filtering EC2 instances by this tag?

https://github.com/philips-labs/terraform-aws-github-runner/blob/00b8b52fde0b4051c02c99c12f0a492f9708f809/modules/runners/lambdas/runners/src/scale-runners/runners.ts#L32-L40

@npalm

npalm commented Oct 27, 2021

Copy link
Copy Markdown
Member

Ahh that's a shame.

I'm no great dev, but it looks to me as if the only place where the functions are using the Environment tag is in the listEC2Runners function within runners.ts

Is your proposal that the tag key is made configurable within the Terraform code? If so, would it be correct to say that what needs doing is putting the configured tag key value in the parameter store and fetching that in the Lambda to be used when filtering EC2 instances by this tag?

https://github.com/philips-labs/terraform-aws-github-runner/blob/00b8b52fde0b4051c02c99c12f0a492f9708f809/modules/runners/lambdas/runners/src/scale-runners/runners.ts#L32-L40

Thanks for taking the time, looking on the changed files. You miss several places. I would prefer:

  1. Not make it optional to have an environment or namespace tag. Simply because the moduel relies on it.
  2. Have the option to define the key used for the tag
  3. Rename environment to namespace, since it is clearly a better term.

@sammort sammort closed this Oct 27, 2021
@sammort
sammort deleted the sm-environment-tag-toggle branch October 27, 2021 08:17
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.

2 participants