Skip to content

Commit

Permalink
🚚 Update 'password-workspace-admin' to use pulumi-random
Browse files Browse the repository at this point in the history
  • Loading branch information
jemrobinson committed Oct 9, 2023
1 parent 98f6834 commit 7625328
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions data_safe_haven/commands/deploy_sre.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
DataSafeHavenError,
)
from data_safe_haven.external import GraphApi
from data_safe_haven.functions import alphanumeric, bcrypt_salt, password
from data_safe_haven.functions import alphanumeric, bcrypt_salt
from data_safe_haven.infrastructure import SHMStackManager, SREStackManager
from data_safe_haven.provisioning import SREProvisioningManager
from data_safe_haven.utility import DatabaseSystem, SoftwarePackageCategory
Expand Down Expand Up @@ -141,7 +141,6 @@ def deploy_sre(
)
# Add necessary secrets
stack.copy_secret("password-domain-ldap-searcher", shm_stack)
stack.add_secret("password-workspace-admin", password(20), replace=False)
stack.add_secret("salt-dns-server-admin", bcrypt_salt(), replace=False)
stack.add_secret("token-azuread-graphapi", graph_api.token, replace=True)

Expand Down
12 changes: 6 additions & 6 deletions data_safe_haven/infrastructure/stacks/sre/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ def __init__(
self.networking_resource_group_name = Output.from_input(
networking_resource_group
).apply(get_name_from_rg)
self.password_workspace_admin = self.get_secret(
pulumi_opts, "password-workspace-admin"
)
self.private_dns_zone_base_id = self.get_secret(
pulumi_opts, "shm-networking-private_dns_zone_base_id"
)
Expand Down Expand Up @@ -332,11 +329,14 @@ def __init__(
tags=child_tags,
)

# Deploy key vault secrets
# Secret: Workspace admin password
password_workspace_admin = pulumi_random.RandomPassword(
f"{self._name}_password_workspace_admin", length=20, special=True
)
keyvault.Secret(
f"{self._name}_kvs_password_workspace_admin",
properties=keyvault.SecretPropertiesArgs(
value=props.password_workspace_admin
value=password_workspace_admin.result
),
resource_group_name=resource_group.name,
secret_name="password-workspace-admin",
Expand Down Expand Up @@ -757,5 +757,5 @@ def __init__(
self.password_user_database_admin = Output.secret(
password_user_database_admin.result
)
self.password_workspace_admin = Output.secret(props.password_workspace_admin)
self.password_workspace_admin = Output.secret(password_workspace_admin.result)
self.resource_group_name = resource_group.name

0 comments on commit 7625328

Please sign in to comment.