Add an alert to warn users about using a period in a Terraform state name
Context
We now have 2 situations that could be warned about:
On GitLab.com (ff is enabled) and self-managed which chose to enable it manually
- Periods are already allowed, as the FF is enabled.
- If they were trying to use periods before with
-lock=false
, then they'll probably see a deploy failure on their terraform job. As a new state will be created with the period, that will diverge from the previous state that got the period truncated.
For these cases, the best would probably be to point them to the new troubleshooting section.
Self-managed with ff disabled
The best would probably be to point them to the deprecations page for 15.7.
Proposal
Add an alert for the users for both situations. As we don't expect many users to visit the terraform state page, the alert can be added to the project's main view page. As it is not trivial to detect if the state name contains a period, we can show the dismissable alert to all users who have Terraform states.
- Troubleshooting link: https://docs.gitlab.com/ee/user/infrastructure/iac/troubleshooting.html#state-not-found-if-the-state-name-contains-a-period
- Deprecation link: https://docs.gitlab.com/ee/update/deprecations.html#support-for-periods--in-terraform-state-names-might-break-existing-states
For more context see the related discussion.
Implementation Guide
This feature needs 2 separate MRs in 2 milestones to be implemented.
- Add a feature id to the callouts list
- Update the GraphQl API Resources with the newly added feature id.
- Add an alert based on the condition
project.terraform_states.exists?
- It can be added into
app/views/projects/_flash_messages.html.haml
as similar toprojects/terraform_banner
- Use GlAlert with
variant="warning"
- Wrap the alert with
UserCalloutDismisser
. You can find an example interraform_notification.vue
.
- It can be added into