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

SHM and SRE should not be allowed to share a name #1850

Open
5 tasks done
jemrobinson opened this issue May 2, 2024 · 6 comments
Open
5 tasks done

SHM and SRE should not be allowed to share a name #1850

jemrobinson opened this issue May 2, 2024 · 6 comments
Assignees
Labels
bug Problem when deploying a Data Safe Haven.

Comments

@jemrobinson
Copy link
Member

jemrobinson commented May 2, 2024

✅ Checklist

  • I have searched open and closed issues for duplicates.
  • This is a problem observed when deploying a Data Safe Haven.
  • I can reproduce this with the latest version.
  • I have read through the documentation.
  • This isn't an open-ended question (open a discussion if it is).

💻 System information

  • Operating System: macOS
  • Data Safe Haven version: develop @ c1d0adc

🚫 Describe the problem

If an SHM and SRE share a name then the keys in pulumi.yaml will be clobbered.

This happens because the YAML file does not distinguish between SHM and SRE projects, e.g.

projects:
  apple:
    encrypted_key: <key>
    stack_config:
      azure-native:location: uksouth
      ...
  green:
    encrypted_key: <key>
    stack_config:
      azure-native:location: uksouth
      ...

🌳 Log messages

Relevant log messages
Your log details here

♻️ To reproduce

  • Deploy an SHM
  • Attempt to deploy an SRE with the same name
@jemrobinson jemrobinson added the bug Problem when deploying a Data Safe Haven. label May 2, 2024
@jemrobinson jemrobinson added this to the Release 5.0.0rc2 milestone May 2, 2024
@JimMadge
Copy link
Member

JimMadge commented May 2, 2024

Does it let you do that? I thought I had prevented that from happening,

def __setitem__(self, key: str, value: DSHPulumiProject) -> None:
"""
Add a DSH Pulumi Project.
This method does not support modifying existing projects.
"""
if not isinstance(key, str):
msg = "'key' must be a string."
raise TypeError(msg)
if key in self.project_names:
msg = f"Stack {key} already exists."
raise ValueError(msg)
self.projects[key] = value

Do we want to allow different components to have identical names?

@jemrobinson
Copy link
Member Author

  1. You can upload a config which contains an SHM and SRE with the same name.
  2. If you run dsh deploy sre <same name as shm> then the deployment starts running.

It's possible that writing pulumi.yaml to Azure after the SRE has been deployed might fail, but I think we should be catching this at (1), not allowing the deployment to go ahead.

Alternatively, we could add an shm- or sre- prefix to the name in the pulumi.yaml file if you prefer?

@JimMadge
Copy link
Member

JimMadge commented May 3, 2024

Hmm, In that case I would guess 'create_or_select_project` would fetch the existing Pulumi configuration and stack state. Deploying would presumably then delete the SHM as it isn't defined in the SRE program.

I think adding an enum to DSHPulumiProject which is SHM | SRE would be a good solution. File/project/stack names could be modified based on that.

@jemrobinson jemrobinson changed the title SHM and SRE cannot share a name SHM and SRE should not be allowed to share a name May 3, 2024
@JimMadge
Copy link
Member

@jemrobinson Does this still need to be done, or are we expecting to remove the SHM entirely for rc2?

@jemrobinson
Copy link
Member Author

Let's leave it until we've worked out whether that's possible.

@JimMadge
Copy link
Member

Related to #1900. Will not be necessary if that is closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Problem when deploying a Data Safe Haven.
Projects
None yet
Development

No branches or pull requests

2 participants