Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promote modules/govuk to a deployment #132

Merged
merged 4 commits into from Jan 15, 2021
Merged

Conversation

richardTowers
Copy link
Contributor

@richardTowers richardTowers commented Jan 15, 2021

Previously we had the govuk-test deployment, which was supposed to
configure things which were specific to the test environment and then
pass them down to the govuk module.

But then we ended up pulling (almost) all of the environment specific
configuration out into .tfvars files in variables/test/*.tfvars, so the
govuk-test deployment ended up not knowing very much about the test
environment. Instead, it just became a really annoying layer of
indirection - any variable or outputs needed to be passed through both
the deployment and the module.

Removing this layer of indirection should make our lives much easier.

The terraform plan for this is going to be an absolute abomination,
but I think we should be able to fix that with:

terraform state list | while read -ra line; do
  # If the line starts with `module.govuk`
  if grep "^module\.govuk\." <<< "$line"; then
    # Then move it in the statefile to a location without the module.govuk. prefix
    terraform state mv "$line" "${line#module.govuk.}"
  fi
done

Copy link
Contributor

@bilbof bilbof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent change 👏

Previously we had the govuk-test deployment, which was supposed to
configure things which were specific to the test environment and then
pass them down to the govuk module.

But then we ended up pulling (almost) all of the environment specific
configuration out into .tfvars files in variables/test/*.tfvars, so the
govuk-test deployment ended up not knowing very much about the test
environment. Instead, it just became a really annoying layer of
indirection - any variable or outputs needed to be passed through both
the deployment and the module.

Removing this layer of indirection should make our lives much easier.

That the terraform plan for this is going to be an absolute abomination,
but I think we should be able to fix that with:

```
terraform state list | while read -ra line; do
  # If the line starts with `module.govuk`
  if grep "^module\.govuk\." <<< "$line"; then
    # Then move it in the statefile to a location without the module.govuk. prefix
    terraform state mv "$line" "${line#module.govuk.}"
  fi
done
```
Copy link
Contributor

@bilbof bilbof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff 🥇

@richardTowers richardTowers merged commit 2a91c0b into main Jan 15, 2021
@richardTowers richardTowers deleted the promote-govuk-module branch January 15, 2021 18:01
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.

None yet

2 participants