|
2 | 2 |
|
3 | 3 | The `terraform-provider-envbuilder` is a Terraform provider that acts as a helper for setting up [`envbuilder`](https://envbuilder.sh) environments.
|
4 | 4 |
|
| 5 | +It is used to determine if a pre-built image of a Devcontainer built from a given Git repository is present in a given Docker registry. |
| 6 | +If all layers that would result from building a particular devcontainer are present in the remote registry, then that image can simply be used as the starting point instead. |
| 7 | + |
| 8 | +## Usage |
| 9 | + |
| 10 | +Below is a very basic usage example. This checks a local registry running on port 5000 for an image built from the [Envbuilder Starter Devcontainer repo](https://github.com/coder/envbuilder-starter-devcontainer). |
| 11 | + |
| 12 | +```terraform |
| 13 | +terraform { |
| 14 | + required_providers { |
| 15 | + envbuilder = { |
| 16 | + source = "coder/envbuilder" |
| 17 | + } |
| 18 | + } |
| 19 | +} |
| 20 | +
|
| 21 | +resource "envbuilder_cached_image" "example" { |
| 22 | + builder_image = "ghcr.io/coder/envbuilder:latest" |
| 23 | + git_url = "https://github.com/coder/envbuilder-starter-devcontainer" |
| 24 | + cache_repo = "localhost:5000" |
| 25 | +} |
| 26 | +
|
| 27 | +output "builder_image" { |
| 28 | + value = envbuilder_cached_image.example.builder_image |
| 29 | +} |
| 30 | +
|
| 31 | +output "exists" { |
| 32 | + value = envbuilder_cached_image.example.exists |
| 33 | +} |
| 34 | +
|
| 35 | +output "id" { |
| 36 | + value = envbuilder_cached_image.example.id |
| 37 | +} |
| 38 | +
|
| 39 | +output "image" { |
| 40 | + value = envbuilder_cached_image.example.image |
| 41 | +} |
| 42 | +
|
| 43 | +``` |
| 44 | + |
| 45 | +Take a look at [`envbuilder_cached_image_resource.tf`](./examples/resources/envbuilder_cached_image/envbuilder_cached_image_resource.tf) folder for a more detailed example. |
| 46 | + |
| 47 | +For use with [Coder](https://github.com/coder/coder), see the [Dev Containers documentation](https://coder.com/docs/templates/dev-containers) and check out the example templates: |
| 48 | +- [Docker](https://github.com/coder/coder/tree/main/examples/templates/devcontainer-docker) |
| 49 | +- [Kubernetes](https://github.com/coder/coder/tree/main/examples/templates/devcontainer-kuberntes) |
| 50 | +- [AWS VM](https://github.com/coder/coder/tree/main/examples/templates/devcontainer-aws-vm) |
| 51 | +- [GCP VM](https://github.com/coder/coder/tree/main/examples/templates/devcontainer-gcp-vm) |
| 52 | + |
5 | 53 | ## Requirements
|
6 | 54 |
|
7 | 55 | - [Terraform](https://developer.hashicorp.com/terraform/downloads) >= 1.0
|
|
0 commit comments