# RFC 025: Tagging our Terraform resources

This RFC describes a proposal for how to tag our Terraform-managed resources, so we can find the corresponding Terraform configuration in the console.

**Last modified:** 2020-08-03T15:05:05+01:00

## Problem statement

We manage our infrastructure in Terraform, but our Terraform configurations are split:

* Across many repositories
* Across multiple directories within each repository

This keeps each configuration small, so it can be planned and applied faster.\
It also creates a hard gap between unrelated services -- for example, a change in the storage service shouldn't affect the catalogue pipeline.

However, this approach can make it hard to find the definition of any particular resource.

If you're looking at a resource in the console, you should be able to tell:

* Is this resource managed in Terraform?
* If so, where is the corresponding Terraform configuration?

## Solution

We are going to tag resources in a Terraform configuration like so:

```hcl
tags = {
  TerraformConfigurationURL = "https://github.com/wellcomecollection/:repo_name/:configuration_path"
}
```

The tag will point to a URL where you can find the Terraform configuration.\
Every resource in a configuration will have the same tag -- this is a clue, rather than an exact file reference.

## Notes

* We are going to tag as many resources as we can do quickly, but the goal is not 100%.\
  Trying to tag every last resource could get very fiddly, and the added value drops off quickly.
* Because we tend to put staging and production resource in separate configurations, these tags will start to give us a way to break down costs among services.
* We are not going to tag resources with a named, responsible individual -- we all have collective responsibility for the platform.\
  If there are resources that only person understands or can maintain, that is a problem we need to fix.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wellcomecollection.org/request-for-comments-rfcs/025-tagging-our-resources.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
