0.44.0 • Published 5 months ago

@invincible/backstage-plugin-terraform-environments v0.44.0

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
5 months ago

Backstage Terraform Environments Plugin

This plugin allows managing ephemeral Terraform environments using GitHub Issues and Actions.

Features

  • List all Terraform environments
  • View environment details and status
  • Destroy environments that are no longer needed
  • Integration with GitHub Issues for tracking
  • Integration with GitHub Actions for provisioning and destruction

Installation

  1. Install the plugin in your Backstage app:
# From your Backstage root directory
yarn add --cwd packages/app @invincible/backstage-plugin-terraform-environments
  1. Configure the plugin in your app-config.yaml:
terraformenvironments:
  defaultowner: your-github-org-name
  defaultrepo: your-repo-name
  1. Add the plugin API factory to your packages/app/src/apis.ts:
import { 
  createApiFactory,
  configApiRef,
} from '@backstage/core-plugin-api';
import { scmAuthApiRef } from '@backstage/integration-react';
import { 
  terraformEnvironmentsApiRef,
  createTerraformEnvironmentsApi 
} from '@invincible/backstage-plugin-terraform-environments';

export const apis = [
  // ... existing API factories
  
  // Add the Terraform Environments API
  createApiFactory({
    api: terraformEnvironmentsApiRef,
    deps: { scmAuthApi: scmAuthApiRef },
    factory: ({ scmAuthApi }) => createTerraformEnvironmentsApi(scmAuthApi),
  }),
];
  1. Add the plugin page to your packages/app/src/App.tsx:
import { TerraformEnvironmentsPage } from '@invincible/backstage-plugin-terraform-environments';

// In your routes:
<Route path="/terraform-environments" element={<TerraformEnvironmentsPage />} />

GitHub Configuration

The plugin requires GitHub authentication to be set up in your Backstage instance:

  1. Create a GitHub App or Personal Access Token with the following permissions:

    • repo (full access to repositories)
    • workflow (ability to trigger workflows)
  2. Configure GitHub authentication in your app-config.yaml:

integrations:
  github:
    - host: github.com
      token: ${GITHUB_TOKEN}

GitHub Action Workflows

The plugin works with two GitHub Action workflows:

  1. terraform-pr.yml: Creates environments when PR is opened
  2. destroy-environment.yml: Destroys environments when requested

These workflows should be placed in .github/workflows/ in your infrastructure repository.

Troubleshooting

If you encounter any issues with the plugin:

  1. Check your browser console for error messages
  2. Verify that the GitHub token has the required permissions
  3. Make sure your app-config.yaml has the correct configuration
  4. Check that the GitHub repository exists and is accessible

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

0.44.0

5 months ago

0.43.0

5 months ago

0.42.0

5 months ago

0.41.0

5 months ago

0.40.0

5 months ago

0.39.0

5 months ago

0.38.0

5 months ago

0.37.0

5 months ago

0.35.0

5 months ago

0.34.0

5 months ago

0.33.0

5 months ago

0.32.0

5 months ago

0.31.0

5 months ago

0.30.0

5 months ago

0.29.0

5 months ago

0.28.0

5 months ago

0.27.0

5 months ago

0.26.0

5 months ago

0.25.0

5 months ago

0.24.0

5 months ago

0.23.0

5 months ago

0.22.0

5 months ago

0.21.0

5 months ago

0.20.0

5 months ago

0.19.0

5 months ago

0.18.0

5 months ago

0.17.0

5 months ago

0.14.0

5 months ago

0.12.0

5 months ago

0.11.0

5 months ago

0.10.0

5 months ago

0.9.0

5 months ago

0.8.0

5 months ago

0.7.0

5 months ago

0.6.0

5 months ago

0.5.0

5 months ago

0.4.0

5 months ago

0.3.0

5 months ago

0.2.0

5 months ago

0.1.0

5 months ago