Skip to content

Commit 98f9fd3

Browse files
committed
Envbuilder
1 parent 76d8aa9 commit 98f9fd3

25 files changed

+350
-691
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,5 @@ website/vendor
3333

3434
# Keep windows files with windows line endings
3535
*.winfile eol=crlf
36+
37+
terraform-provider-envbuilder

CHANGELOG.md

-3
This file was deleted.

GNUmakefile

+13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
default: testacc
22

3+
test: testacc
4+
35
# Run acceptance tests
46
.PHONY: testacc
57
testacc:
68
TF_ACC=1 go test ./... -v $(TESTARGS) -timeout 120m
9+
10+
fmt: examples/*/*.tf
11+
terraform fmt -recursive
12+
13+
gen:
14+
go generate
15+
16+
build: terraform-provider-envbuilder
17+
18+
terraform-provider-envbuilder: internal/provider/*.go main.go
19+
CGO_ENABLED=0 go build .

README.md

+3-29
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,11 @@
1-
# Terraform Provider Scaffolding (Terraform Plugin Framework)
1+
# terraform-provider-envbuilder
22

3-
_This template repository is built on the [Terraform Plugin Framework](https://github.com/hashicorp/terraform-plugin-framework). The template repository built on the [Terraform Plugin SDK](https://github.com/hashicorp/terraform-plugin-sdk) can be found at [terraform-provider-scaffolding](https://github.com/hashicorp/terraform-provider-scaffolding). See [Which SDK Should I Use?](https://developer.hashicorp.com/terraform/plugin/framework-benefits) in the Terraform documentation for additional information._
4-
5-
This repository is a *template* for a [Terraform](https://www.terraform.io) provider. It is intended as a starting point for creating Terraform providers, containing:
6-
7-
- A resource and a data source (`internal/provider/`),
8-
- Examples (`examples/`) and generated documentation (`docs/`),
9-
- Miscellaneous meta files.
10-
11-
These files contain boilerplate code that you will need to edit to create your own Terraform provider. Tutorials for creating Terraform providers can be found on the [HashiCorp Developer](https://developer.hashicorp.com/terraform/tutorials/providers-plugin-framework) platform. _Terraform Plugin Framework specific guides are titled accordingly._
12-
13-
Please see the [GitHub template repository documentation](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-from-a-template) for how to create a new repository from this template on GitHub.
14-
15-
Once you've written your provider, you'll want to [publish it on the Terraform Registry](https://developer.hashicorp.com/terraform/registry/providers/publishing) so that others can use it.
3+
The `terraform-provider-envbuilder` is a Terraform provider that acts as a helper for setting up [`envbuilder`](https://envbuilder.sh) environments.
164

175
## Requirements
186

197
- [Terraform](https://developer.hashicorp.com/terraform/downloads) >= 1.0
20-
- [Go](https://golang.org/doc/install) >= 1.21
8+
- [Go](https://golang.org/doc/install) >= 1.22
219

2210
## Building The Provider
2311

@@ -29,20 +17,6 @@ Once you've written your provider, you'll want to [publish it on the Terraform R
2917
go install
3018
```
3119

32-
## Adding Dependencies
33-
34-
This provider uses [Go modules](https://github.com/golang/go/wiki/Modules).
35-
Please see the Go documentation for the most up to date information about using Go modules.
36-
37-
To add a new dependency `github.com/author/dependency` to your Terraform provider:
38-
39-
```shell
40-
go get github.com/author/dependency
41-
go mod tidy
42-
```
43-
44-
Then commit the changes to `go.mod` and `go.sum`.
45-
4620
## Using the provider
4721

4822
Fill this in for each provider

docs/data-sources/cached_image.md

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "envbuilder_cached_image Data Source - envbuilder"
4+
subcategory: ""
5+
description: |-
6+
The cached image data source can be used to retrieve a cached image produced by envbuilder.
7+
---
8+
9+
# envbuilder_cached_image (Data Source)
10+
11+
The cached image data source can be used to retrieve a cached image produced by envbuilder.
12+
13+
## Example Usage
14+
15+
```terraform
16+
data "envbuilder_cached_image" "example" {
17+
builder_image = "ghcr.io/coder/envbuilder:latest"
18+
git_url = "https://github.com/coder/envbuilder-starter-devcontainer"
19+
cache_repo = "localhost:5000/local/test-cache"
20+
extra_env = {
21+
"ENVBUILDER_VERBOSE" : "true"
22+
}
23+
}
24+
25+
resource "docker_container" "container" {
26+
image = envbuilder_cached_image.example.image
27+
env = data.envbuilder_image.cached.env
28+
}
29+
```
30+
31+
<!-- schema generated by tfplugindocs -->
32+
## Schema
33+
34+
### Required
35+
36+
- `builder_image` (String) The builder image URL to use if the cache does not exist.
37+
- `cache_repo` (String) The name of the container registry to fetch the cache image from.
38+
- `git_url` (String) The URL of a Git repository containing a Devcontainer or Docker image to clone.
39+
40+
### Optional
41+
42+
- `cache_ttl_days` (Number) The number of days to use cached layers before expiring them. Defaults to 7 days.
43+
- `extra_env` (Map of String) Extra environment variables to set for the container. This may include evbuilder options.
44+
- `git_password` (String, Sensitive) The password to use for Git authentication. This is optional.
45+
- `git_username` (String) The username to use for Git authentication. This is optional.
46+
47+
### Read-Only
48+
49+
- `env` (List of String) Computed envbuilder configuration to be set for the container.
50+
- `exists` (Boolean) Whether the cached image was exists or not for the given config.
51+
- `id` (String) Cached image identifier
52+
- `image` (String) Outputs the cached image URL if it exists, otherwise the builder image URL is output instead.

docs/data-sources/example.md

-30
This file was deleted.

docs/functions/example.md

-26
This file was deleted.

docs/index.md

+3-9
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,20 @@
11
---
22
# generated by https://github.com/hashicorp/terraform-plugin-docs
3-
page_title: "scaffolding Provider"
3+
page_title: "envbuilder Provider"
44
subcategory: ""
55
description: |-
66
77
---
88

9-
# scaffolding Provider
9+
# envbuilder Provider
1010

1111

1212

1313
## Example Usage
1414

1515
```terraform
16-
provider "scaffolding" {
17-
# example configuration here
18-
}
16+
provider "envbuilder" {}
1917
```
2018

2119
<!-- schema generated by tfplugindocs -->
2220
## Schema
23-
24-
### Optional
25-
26-
- `endpoint` (String) Example provider attribute

docs/resources/example.md

-31
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
data "envbuilder_cached_image" "example" {
2+
builder_image = "ghcr.io/coder/envbuilder:latest"
3+
git_url = "https://github.com/coder/envbuilder-starter-devcontainer"
4+
cache_repo = "localhost:5000/local/test-cache"
5+
extra_env = {
6+
"ENVBUILDER_VERBOSE" : "true"
7+
}
8+
}
9+
10+
resource "docker_container" "container" {
11+
image = envbuilder_cached_image.example.image
12+
env = data.envbuilder_image.cached.env
13+
}

examples/data-sources/scaffolding_example/data-source.tf

-3
This file was deleted.

examples/provider/provider.tf

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
provider "scaffolding" {
2-
# example configuration here
3-
}
1+
provider "envbuilder" {}

examples/resources/scaffolding_example/resource.tf

-3
This file was deleted.

go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
module github.com/hashicorp/terraform-provider-scaffolding-framework
1+
module github.com/mafredri/terraform-provider-envbuilder
22

3-
go 1.21
3+
go 1.22
44

55
require (
66
github.com/hashicorp/terraform-plugin-docs v0.19.4

0 commit comments

Comments
 (0)