ministryofjustice / modernisation-platform

A place for the core work of the Modernisation Platform • This repository is defined and managed in Terraform
https://user-guide.modernisation-platform.service.justice.gov.uk
MIT License
679 stars 290 forks source link

Account creation baselines bug. #7497

Closed ep-93 closed 1 month ago

ep-93 commented 1 month ago

Expected Behavior

Baselines should just plan and apply smoothly.

Actual Behavior

When creating an account, baselines will fail with an error relating to this data call

https://github.com/ministryofjustice/modernisation-platform-terraform-baselines/blob/main/modules/backup/main.tf#L11

Its trying to call a kms key that has not yet been created.

Steps to Reproduce the Problem

Terraform destory on baselines in an account, and then apply, and see the error.

Version

No response

Modules

Baselines - https://github.com/ministryofjustice/modernisation-platform-terraform-baselines

Account

Any new account.

ep-93 commented 1 month ago

So yesteday I worked with Ewa on this adding a cool depends_on in the right place (I was only checking main.tf where all the other modules were called, not backup.tf)

This worked great, until a full destroy and and apply (takes some time annoyingly) chucks this error

│ The "count" value depends on resource attributes that cannot be determined until apply, so Terraform cannot predict
│ how many instances will be created. To work around this, use the -target argument to first apply only the resources
│ that the count depends on.

We dont want that, I will look at this today.