---
id: SAIFTRBL0017
title: "Terraform output event_url, api_url, or app_url not found"
description: A project generated before the service URL outputs were added to the templates has no event_url, api_url, or app_url Terraform output, so the deployed service's base URL is not available to read.
tags:
  - troubleshooting
  - terraform
  - templates
---

# Terraform output event_url, api_url, or app_url not found

If reading the `event_url`, `api_url`, or `app_url` Terraform output fails with `Output "<name>" not found`, your project's infra root predates the template change that added these outputs. Add the matching `output` block to the project's `outputs.tf`, confirm the project uses a module release that exposes the value, and deploy once so the state records the new output.

---

## 🚨 Symptom

There are two forms, and both come from the same missing output declaration.

In the pipeline, the `tf_outputs` step publishes each scalar Terraform output as a `TF_OUTPUT_<name>` variable. A step that reads `TF_OUTPUT_event_url`, `TF_OUTPUT_api_url`, or `TF_OUTPUT_app_url` gets an empty string, because Azure DevOps does not fail on an undefined variable and the `tf_outputs` step exits successfully when an output is absent. The usual sign is a downstream step that skips with a message such as `Skipping … base URL not available`, or a value that is blank in Environment Service.

From the project's infra directory, `terraform output` fails with:

```text
Error: Output "event_url" not found

The output variable requested could not be found in the state file. If you
recently added this to your configuration, be sure to run `terraform
apply`, since the state won't be updated with new output variables until
that command is run.
```

The name in the message is `event_url`, `api_url`, or `app_url`, depending on the project type. Other outputs, such as `resource_group_name`, still work. To distinguish this from a failed deploy, run `terraform output` with no arguments. If the list loads but the URL output is absent, this article applies.

---

## 📌 Applies to

This applies to projects generated from a Forge template before the URL outputs were added, and to the infra root that holds the service module:

| Project type | Infra root | Missing output | Module output it reads |
| --- | --- | --- | --- |
| Event service (`saif-event-service`) | `infra/event` | `event_url` | `module.event_service.event_url` |
| Web app (`saif-feature-front-end-react`, `saif-feature-web-standalone`) | `infra/web` | `app_url` | `module.saif-webapp.app_url` |
| API (projects that include `saif-feature-api`) | `infra/api` | `api_url` | `module.saif-appservices.api_url` |

Do not use this fix if `terraform output` fails for every name, or if the infra root has never been applied. Those are deploy or state problems, not a missing output declaration.

Event services have one more cause. When the OpenAPI file declares no operations, `event_url` is intentionally `null`, and Terraform does not store null root outputs, so `terraform output event_url` reports the same "not found" error even with the output block present. Check whether `infra/event/openapi/` defines at least one operation before you add anything. If it defines none, either add an operation or treat the missing event URL as expected.

### Prerequisites and safety

- Permission to run the project's deploy pipeline for the target environment. The fix is a code change plus a normal deploy.
- The module release your project resolves must expose the output. The templates pin `>= 3.10.0, < 4.0.0`, so check the release notes for the release that adds the URL outputs before you add the block. A block that reads a module output that does not exist fails the plan.
- Adding the output block does not change any resource, but resolving a newer module release can include other changes. Review the deploy plan before you approve it.

---

## ✅ Fix

1. Open the `outputs.tf` in the project's infra root from the table above. Create the file if the root has none.

2. Add the output that matches your project type:

    ```hcl
    # infra/event/outputs.tf
    output "event_url" {
      value = module.event_service.event_url
    }
    ```

    ```hcl
    # infra/web/outputs.tf
    output "app_url" {
      value = module.saif-webapp.app_url
    }
    ```

    ```hcl
    # infra/api/outputs.tf
    output "api_url" {
      value = module.saif-appservices.api_url
    }
    ```

3. Commit the change and run the project's deploy pipeline for the environment. Terraform does not write a new output to the state until an apply runs.

---

## 🔬 Verify

From the infra root, after the deploy finishes, read the output:

```powershell
terraform output -raw event_url
```

Use `app_url` or `api_url` for those project types. In the pipeline, the `tf_outputs` step in the deploy job publishes the same value as `TF_OUTPUT_event_url` (or `_app_url`, `_api_url`) for later jobs. Expected result is the service's Front Door URL for that environment, for example:

```text
https://app-int-<env>.saif.com/api/event/<service-name>
```

Web apps and APIs follow the same shape, with `https://app-<env>.saif.com/<application-name>` for an external web app. If the output is still missing, confirm the deploy applied the infra root you edited and not a different one. If the plan fails on `module.<name>.<output>`, the project resolves a module release without the output, so move to a release that includes it.

---

## 🧠 Cause

The templates now declare a URL output for each service type, built from the environment's base URL (`context.naming.internal_base_url` or `external_base_url`) plus the service path. Projects generated earlier copied the old template files, which have no such output, and template changes do not rewrite existing projects. Terraform only exposes outputs that the configuration declares, so the name is absent from the state until you declare it and apply.

---

## 📚 Related

- [Feature request: Register event-service keys and API base URL in Environment Service/Crypto](https://github.com/saif-corp/forge/issues/1277)
- [Template and module change that adds the URL outputs](https://github.com/saif-corp/forge/pull/1278)
- [Service URLs](../reference/service-urls.md)
- [Subscription key missing in EnvironmentBoss for an environment](subscription-key-missing-for-environment.md)
