# Set up CI/CD common

Install the `cicd-common` stack to be able to run GitHub Actions workflows for Terraform.

## Step 1: Install `cicd-common`

```bash title="repo-iac/environments/dev/"
ok pkg add cicd-common
cd cicd-common
ok pkg install
```

To configure proper IAM roles and resources in AWS, update `config_override.tf`:

```hcl title="repo-iac/environments/dev/cicd-common/config_override.tf"
locals {
  trusted_repositories = [
    {
      name  = "<repo-name>"
      type  = "infra"
    },
  ]
}
```

Update these values:

| Field         | Description                 | Example       |
| ------------- | --------------------------- | ------------- |
| `<repo-name>` | Name of your IaC repository | `pirates-iac` |

## Step 2: Apply

Commit and push to main (or via a pull request).

Apply the new Terraform code from your local machine:

```bash title="repo-iac/environments/dev/cicd-common/"
terraform init
terraform apply
```

---

## Next step

Set up [Terraform workflows](set-up-terraform-workflows.md).
