---
title: Deleting a user
slug: hosty/deleting-a-user
createdAt: 2026-11-08T11:27:49.007Z
---

To delete a user, first remove their credentials in the AWS Console, then remove them from `main.tf`. OpenTofu can't delete an IAM user that still has a password, access keys or an MFA device.

If it's the user of CI, give the CI of the project new keys first, or its deployments stop. See [Adding a new user](https://wiki.systemseed.com/hosty/adding-a-new-user).

## 1. Remove the credentials

Open IAM, then **Users**, the user, and the **Security credentials** tab. There:

- deactivate and delete all access keys;
- remove all MFA devices;
- disable console access;
- delete anything else listed there, such as SSH keys or signing certificates.

## 2. Remove the user from main.tf

In `terraform/main.tf`, remove the username from:

- `users`;
- `administrators`, if it's there;
- `lead_developers`, `developers` and `release_managers` of every project.

If the user stays in any of the lists after you remove it from `users`, the plan fails.

Then apply:

```bash
cd /src/terraform
tofu plan
tofu apply
```

OpenTofu deletes the IAM user, removes it from its groups and clusters, and deletes its VPN profiles from the bucket `vpn.<hosted zone>`.

## The VPN profile still works

:::hint{type="warning"}
Deleting the user doesn't revoke a VPN profile they have already downloaded. The VPN accepts any certificate signed by the certificate authority of the cluster, and the certificates are valid for 10 years. Without an IAM user, they can't use AWS or the API of the cluster, but they can still connect to the network of the cluster.
:::

To cut them off, import a certificate revocation list with their certificate into the Client VPN endpoint of each cluster, as described in [the AWS documentation](https://docs.aws.amazon.com/vpn/latest/clientvpn-admin/cvpn-working-certificates.html). The certificate authority that signs the list is in the state of OpenTofu.
