Skip to content

Allow creating resources for multiple environments in the same account.#120

Open
TurboNHS wants to merge 6 commits intomainfrom
turbo-resources-in-same-account2
Open

Allow creating resources for multiple environments in the same account.#120
TurboNHS wants to merge 6 commits intomainfrom
turbo-resources-in-same-account2

Conversation

@TurboNHS
Copy link
Copy Markdown

@TurboNHS TurboNHS commented Apr 23, 2026

Description

If there's multiple environment builds in the same account (such as dev, test, non-prod etc), we can't create ALL resources in that account.

Plans and frameworks are account specific, not environment specific.
As in, a plan will have a selection (such as "backup everything with the tag xyz set to abc"). So having separate plans for each env doesn make any sense, they will be identical and backup the same resources.

So introduce a new variable resources_in_same_account which should be set to the account where everything (the "account specific" resources) are created.

Depends on: include_environment_in_resource_names = true.
Depends on: #118

NOTE: In this PR, the #118 PR is included, because it builds on that! That PR needs to be merged before this, which should then be rebased to remove that first commit, before this PR can be merged.

Context

Type of changes

  • Refactoring (non-breaking change)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would change existing functionality)
  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I am familiar with the contributing guidelines
  • I have followed the code style of the project
  • I have added tests to cover my changes
  • I have updated the documentation accordingly
  • This PR is a result of pair or mob programming

Sensitive Information Declaration

To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including PII (Personal Identifiable Information) / PID (Personal Identifiable Data) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter.

  • I confirm that neither PII/PID nor sensitive data are included in this PR and the codebase changes.

If we're going to be able to have all resources for multiple environments
in one account (PR pending), we must make sure that all resources have the
environment name in them, so they can be separated.
The AWSBackup/Framework must be unique in the account. As in, it's not possible
to create the framework with the same rules etc.

Instead, we "import" the "base" framework, and use that where needed.
…ble.

It was included in the main variable for all types, but Aurora.

With a value of:
```
module "source" {
  [...]
  backup_plan_config_XXX = {
    [...]
    "selection_tags" : [
      {
	"key": "Environment"
	"value": var.environment
      },
      {
	"key": "Stack"
	"value": "rds-cluster"
      },
      {
	"key": "ManagedBy"
	"value": "Terraform"
      }
    ]
    [...]
  }

  [...]
}
```

We narrow down the list of resources that the plan etc will find to
only that of the environment (tag `Environment=dev` for example).

Before this commit, it would only look for `selection_tag=selection_tag_value`,
which would catch all resources with that tag set. One could set
different tags for different environments, but that would be confusing
in the long run. Better to have the same tag for the backup, but specify
the environment as well.
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.

1 participant