https://github.com/spacechunks/packer-plugin-s3
HashiCorp Packer plugin providing a provisioner for S3 file retrival
https://github.com/spacechunks/packer-plugin-s3
packer packer-plugin packer-provisioner s3
Last synced: about 2 months ago
JSON representation
HashiCorp Packer plugin providing a provisioner for S3 file retrival
- Host: GitHub
- URL: https://github.com/spacechunks/packer-plugin-s3
- Owner: spacechunks
- License: mit
- Created: 2024-09-08T16:42:01.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-04-04T23:20:45.000Z (2 months ago)
- Last Synced: 2025-04-05T00:22:04.441Z (2 months ago)
- Topics: packer, packer-plugin, packer-provisioner, s3
- Language: Go
- Homepage:
- Size: 43.9 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# packer-plugin-s3
This plugin provides a simple provisioner, that retrieves objects from s3 and stores them at the given destination.
**Example**
```hcl
packer {
required_plugins {
s3 = {
version = "2.0.3"
source = "github.com/spacechunks/s3"
}
}
}provisioner "s3" {
profile = "" // optional
objects {
source = "mybucket/myfolder/somefile"
destination = "/etc/myobject2"
}
objects {
source = "mybucket2/myfolder/somefile"
destination = "/etc/myobject2"
}
}
```**Configuration**
You can either define credentials in your AWS config file.
This example uses access and secret keys, but you can also define IAM credentials and SSO.```
[profile test]
aws_access_key_id = my_secret_key
aws_secret_access_key = my_access_key
services = services
region = my_region[services services]
s3 =
endpoint_url = https://my_endpoint_url
```or define them using environment variables
```
export AWS_ACCESS_KEY_ID=my_secret_key
export AWS_SECRET_ACCESS_KEY=my_access_key
export AWS_ENDPOINT_URL=https://my_endpoint_url
export AWS_REGION=my_region
```## Development
Running the tests:
* `make test` to run acceptance and unit tests
* `make test_unit` to only run unit tests
* `make test_acc` to only run acceptance tests (needs to have Docker installed)Installing the plugin locally:
* `make install`When changing the provisioners config you have to run `make gen` after, so the `hcl2spec.go` file gets generated.
If you encounter the following error while trying to build the plugin
```
cannot use cty.Value{} (value of type cty.Value) as gob.GobEncoder value in variable declaration
```checkout this link https://github.com/hashicorp/packer-plugin-sdk/issues/187