@globallogicuki/backstage-plugin-terraform-backend

中文文档
0.12.0发布于 2026/08/25Apache-2.0TypeScriptCommonJS近 30 天下载 5858

Backstage backend plugin proxying the Terraform Cloud/Enterprise API for the terraform frontend plugin

原始使用文档
文档目录6 节
  1. Install
  2. Setup
  3. New Backstage backend system
  4. Legacy Backstage backend system
  5. Status Check
  6. Updating OpenAPI Spec

Terraform Backend Plugin for Backstage

This plugin is the backend api used by the terraform frontend plugin.

Install

yarn add @globallogicuki/backstage-plugin-terraform-backend

Setup

To use the terraform backend, you will need to configure the following in your app-config.yaml file:

integrations:
  terraform:
    token: tokenGoesHere
    baseUrl: https://tfe.enterprise.com # Optional, for self-hosted TFE. Defaults to https://app.terraform.io
    pageSize: 20 # Optional, override default TF API page size

baseUrl is the web origin of your Terraform instance (it is also used by the frontend plugin to build links to the Terraform UI). The backend derives the API root by appending /api/v2. For backwards compatibility, a baseUrl that already ends in /api/v2 is used as-is by the backend.

New Backstage backend system

You must be using v0.3.0 or greater of the backend and frontend plugin if you are using the new Backstage backend system. See here for more info.

Add the following to packages/backend/src/index.ts:

backend.add(import('@globallogicuki/backstage-plugin-terraform-backend'));

Legacy Backstage backend system

Create a new file named packages/backend/src/plugins/terraform.ts, and add the following to it:

import { createRouter } from '@globallogicuki/backstage-plugin-terraform-backend';
import { Router } from 'express';
import { PluginEnvironment } from '../types';

export default async function createPlugin(
  env: PluginEnvironment,
): Promise<Router> {
  return await createRouter({
    logger: env.logger,
    config: env.config,
  });
}

And finally, wire this into the overall backend router. Edit packages/backend/src/index.ts:

import terraform from './plugins/terraform';
// ...
async function main() {
  // ...
  const terraformEnv = useHotMemoize(module, () => createEnv('terraform'));
  apiRouter.use('/terraform', await terraform(terraformEnv));

Status Check

After you start the backend (e.g. using yarn start-backend from the repo root), you should be able to fetch data from it.

curl localhost:7007/api/terraform/health

This should return {"status":"ok"}.

Updating OpenAPI Spec

OpenAPI spec can be found in src/schema/openapi.yaml

Once this file has been modified you should run the following to generate an update for src/schema/openapi.generated.yaml

yarn generate-openapi-schema

版本与发布记录

@globallogicuki/backstage-plugin-terraform-backend 共发布 28 个版本,首次发布于 2024/02/16;过去 12 个月发布了 7 个版本。

版本发布日期距今
0.12.0latest2026/08/252 个月前
0.10.62026/08/252 个月前
0.10.52026/06/234 个月前
0.10.42025/12/1011 个月前
0.10.32025/12/0511 个月前
0.10.22025/12/0311 个月前

关于 @globallogicuki/backstage-plugin-terraform-backend 的常见问题

@globallogicuki/backstage-plugin-terraform-backend 是什么?

Backstage backend plugin proxying the Terraform Cloud/Enterprise API for the terraform frontend plugin

如何安装 @globallogicuki/backstage-plugin-terraform-backend?

在项目目录运行 npm install @globallogicuki/backstage-plugin-terraform-backend,或使用 pnpm add / yarn add / bun add。

@globallogicuki/backstage-plugin-terraform-backend 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@globallogicuki/backstage-plugin-terraform-backend 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@globallogicuki/backstage-plugin-terraform-backend 可以商用吗?

@globallogicuki/backstage-plugin-terraform-backend 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@globallogicuki/backstage-plugin-terraform-backend 的下载量有多少?

根据 npm 官方下载统计,@globallogicuki/backstage-plugin-terraform-backend 在 2026/10/17 – 2026/11/15 这 30 天内被下载 5,858 次,日均约 195 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@globallogicuki/backstage-plugin-terraform-backend 还在维护吗?

最新版本 0.12.0 发布于 2026/08/25(2 个月前);至今共发布 28 个版本,其中过去 12 个月发布了 7 个;首次发布于 2024/02/16。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。