# Maskinporten

Set up the Maskinporten integration role for applications that use Maskinporten. Configured via the `iam` package.

## Step 1: Add and configure the `iam` package

```bash title="repo-iac/environments/dev/"
ok pkg add iam
```

In `package-config.yml`, enable `MaskinportenKeyRotation`:

```yaml title="iam/package-config.yml"
StackName: "iam"
MaskinportenKeyRotation:
  Enable: true
```

<!-- prettier-ignore-start -->
!!! Warning "Only one per account"
    You can only have one **MaskinportenKeyRotation** enabled per account. If already enabled in a different environment, you cannot enable it here.

    Enabling it will cause an error when applying the stack.
<!-- prettier-ignore-end -->

## Step 2: Install and apply the package

```bash title="iam/"
ok pkg install
terraform init
terraform apply
```

## Step 3: Verify

=== "AWS CLI"

    ```bash
    aws iam list-roles | jq '.Roles[].RoleName' | grep dataplatform-maskinporten
    ```

    Output should contain role `dataplatform-maskinporten`.

=== "AWS console"

    In **IAM**, select **Roles** and search for `dataplatform-maskinporten`.

    List should contain role `dataplatform-maskinporten`.
