Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chainguard-dev/terraform-provider-apko
https://github.com/chainguard-dev/terraform-provider-apko
build container-image terraform terraform-provider
Last synced: about 18 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/chainguard-dev/terraform-provider-apko
- Owner: chainguard-dev
- License: mpl-2.0
- Created: 2022-06-30T23:51:39.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-29T22:30:28.000Z (16 days ago)
- Last Synced: 2024-10-30T00:44:47.158Z (16 days ago)
- Topics: build, container-image, terraform, terraform-provider
- Language: Go
- Homepage: https://registry.terraform.io/providers/chainguard-dev/apko/latest
- Size: 820 KB
- Stars: 14
- Watchers: 1
- Forks: 14
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Terraform Provider for [`apko`](https://github.com/chainguard-dev/apko)
🚨 **This is a work in progress.** 🚨
https://registry.terraform.io/providers/chainguard-dev/apko
## Usage
This provides an `apko_build` resource that will build the provided `apko` configuration, push an image to the configured container repository, and make the image's reference available to other Terraform resources.
```hcl
# Define provider-wide defaults to reduce boilerplate or augment built images
# with additional packages.
provider "apko" {
# Default to building for these architectures.
default_archs = ["x86_64", "aarch64"]# Include these repositories by default
extra_repositories = ["https://packages.wolfi.dev/os"]
extra_keyring = ["https://packages.wolfi.dev/os/wolfi-signing.rsa.pub"]# All of the images should show up as Wolfi!
extra_packages = ["wolfi-baselayout"]
}data "apko_config" "this" {
# Pass in the apko configuration here. If you'd like to define this in a file
# so it can be used with apko as well, you can make this something like this
# instead: config = file("${path.module}/apko.yaml")
config_contents = jsonencode({
contents = {
packages = [
"ca-certificates-bundle",
"tzdata"
]
},
accounts = {
groups = [{
groupname = "nonroot",
gid = 65532
}],
users = [{
username = "nonroot",
uid = 65532,
gid = 65532
}],
run-as = 65532
},
})
}resource "apko_build" "this" {
# Where to publish the resulting image, e.g. docker.io/user/repo
repo = "..."
config = data.apko_config.this.config
}
```The image will be rebuilt every time it's _referenced_, and will only report as having changed if the image that was built was different since the last time the image resource was read.
This means that `terraform plan` will rebuild all referenced images, but only show diffs if rebuilds resulted in new images since last time the plan was made.