https://github.com/cloudposse/terraform-provider-utils
The Cloud Posse Terraform Provider for various utilities (e.g. deep merging, stack configuration management)
https://github.com/cloudposse/terraform-provider-utils
config configuration configuration-management deep-merge provider spacelift stack terraform terraform-providers utilities utils
Last synced: 10 months ago
JSON representation
The Cloud Posse Terraform Provider for various utilities (e.g. deep merging, stack configuration management)
- Host: GitHub
- URL: https://github.com/cloudposse/terraform-provider-utils
- Owner: cloudposse
- License: apache-2.0
- Created: 2021-01-25T15:17:00.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2025-03-28T07:43:01.000Z (11 months ago)
- Last Synced: 2025-03-29T15:11:18.306Z (11 months ago)
- Topics: config, configuration, configuration-management, deep-merge, provider, spacelift, stack, terraform, terraform-providers, utilities, utils
- Language: Go
- Homepage: https://cloudposse.com/accelerate
- Size: 1020 KB
- Stars: 102
- Watchers: 14
- Forks: 18
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
Terraform provider for various utilities (deep merging, Atmos stack configuration management), and to add additional missing functionality to Terraform
> [!TIP]
> #### π½ Use Atmos with Terraform
> Cloud Posse uses [`atmos`](https://atmos.tools) to easily orchestrate multiple environments using Terraform.
> Works with [Github Actions](https://atmos.tools/integrations/github-actions/), [Atlantis](https://atmos.tools/integrations/atlantis), or [Spacelift](https://atmos.tools/integrations/spacelift).
>
>
> Watch demo of using Atmos with Terraform
> 
> Example of running atmos to manage infrastructure from our Quick Start tutorial.
>
## Usage
Here is how to use this provider in your own Terraform code:
```hcl
terraform {
required_providers {
utils = {
source = "cloudposse/utils"
version = ">= 1.17.0"
}
}
}
```
See the [Docs](./docs) for additional information.
> [!IMPORTANT]
> In Cloud Posse's examples, we avoid pinning modules to specific versions to prevent discrepancies between the documentation
> and the latest released versions. However, for your own projects, we strongly advise pinning each module to the exact version
> you're using. This practice ensures the stability of your infrastructure. Additionally, we recommend implementing a systematic
> approach for updating versions to avoid unexpected changes.
## Examples
Here is an example of using this provider:
```hcl
terraform {
required_providers {
utils = {
source = "cloudposse/utils"
}
}
}
locals {
yaml_data_1 = file("${path.module}/data1.yaml")
yaml_data_2 = file("${path.module}/data2.yaml")
}
data "utils_deep_merge_yaml" "example" {
input = [
local.yaml_data_1,
local.yaml_data_2
]
}
output "deep_merge_output" {
value = data.utils_deep_merge_yaml.example.output
}
```
Here are some additional examples:
- [`examples/data-sources/utils_deep_merge_json`](examples/data-sources/utils_deep_merge_json)
- [`examples/data-sources/utils_deep_merge_yaml`](examples/data-sources/utils_deep_merge_yaml)
## Developing the Provider
If you wish to work on the provider, you'll first need [Go](http://www.golang.org) installed on your machine (see [Requirements](#requirements) above).
To compile the provider, run `go install`. This will build the provider and put the provider binary in the `$GOPATH/bin` directory.
To generate or update documentation, run `go generate`.
In order to run the full suite of Acceptance tests, run `make testacc`.
_Note:_ Acceptance tests create real resources, and often cost money to run.
```sh
$ make testacc
```
### Testing Locally
You can test the provider locally by using the [provider_installation](https://www.terraform.io/docs/cli/config/config-file.html#provider-installation) functionality.
For testing this provider, you can edit your `~/.terraformrc` file with the following:
```hcl
provider_installation {
dev_overrides {
"cloudposse/utils" = "/path/to/your/code/github.com/cloudposse/terraform-provider-utils/"
}
# For all other providers, install them directly from their origin provider
# registries as normal. If you omit this, Terraform will _only_ use
# the dev_overrides block, and so no other providers will be available.
direct {}
}
```
With that in place, you can build the provider (see above) and add a provider block:
```hcl
required_providers {
utils = {
source = "cloudposse/utils"
}
}
```
Then run `terraform init`, `terraform plan` and `terraform apply` as normal.
```sh
$ terraform init
Initializing the backend...
Initializing provider plugins...
- Finding latest version of cloudposse/utils...
Warning: Provider development overrides are in effect
The following provider development overrides are set in the CLI configuration:
- cloudposse/utils in /path/to/your/code/github.com/cloudposse/terraform-provider-utils
The behavior may therefore not match any released version of the provider and
applying changes may cause the state to become incompatible with published
releases.
```
```sh
terraform apply
Warning: Provider development overrides are in effect
The following provider development overrides are set in the CLI configuration:
- cloudposse/utils in /Users/matt/code/src/github.com/cloudposse/terraform-provider-utils
The behavior may therefore not match any released version of the provider and
applying changes may cause the state to become incompatible with published
releases.
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
Terraform will perform the following actions:
Plan: 0 to add, 0 to change, 0 to destroy.
Changes to Outputs:
+ deep_merge_output = <<-EOT
Statement:
- Action:
- s3:*
Effect: Allow
Resource:
- '*'
Sid: FullAccess
- Action:
- s3:*
Complex:
ExtraComplex:
ExtraExtraComplex:
Foo: bazzz
SomeArray:
- one
- two
- three
Effect: Deny
Resource:
- arn:aws:s3:::customer
- arn:aws:s3:::customer/*
- foo
Sid: DenyCustomerBucket
Version: "2012-10-17"
EOT
```
## Related Projects
Check out these related projects.
## References
For additional context, refer to some of these links.
- [Terraform Plugins](https://www.terraform.io/docs/extend/plugin-types.html#providers) - Terraform is logically split into two main parts: Terraform Core and Terraform Plugins. Each plugin exposes an implementation for a specific service, such as the AWS provider or the cloud-init provider.
> [!TIP]
> #### Use Terraform Reference Architectures for AWS
>
> Use Cloud Posse's ready-to-go [terraform architecture blueprints](https://cloudposse.com/reference-architecture/) for AWS to get up and running quickly.
>
> β
We build it together with your team.
> β
Your team owns everything.
> β
100% Open Source and backed by fanatical support.
>
>
> π Learn More
>
>
>
> Cloud Posse is the leading [**DevOps Accelerator**](https://cpco.io/commercial-support?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-provider-utils&utm_content=commercial_support) for funded startups and enterprises.
>
> *Your team can operate like a pro today.*
>
> Ensure that your team succeeds by using Cloud Posse's proven process and turnkey blueprints. Plus, we stick around until you succeed.
> #### Day-0: Your Foundation for Success
> - **Reference Architecture.** You'll get everything you need from the ground up built using 100% infrastructure as code.
> - **Deployment Strategy.** Adopt a proven deployment strategy with GitHub Actions, enabling automated, repeatable, and reliable software releases.
> - **Site Reliability Engineering.** Gain total visibility into your applications and services with Datadog, ensuring high availability and performance.
> - **Security Baseline.** Establish a secure environment from the start, with built-in governance, accountability, and comprehensive audit logs, safeguarding your operations.
> - **GitOps.** Empower your team to manage infrastructure changes confidently and efficiently through Pull Requests, leveraging the full power of GitHub Actions.
>
>
>
> #### Day-2: Your Operational Mastery
> - **Training.** Equip your team with the knowledge and skills to confidently manage the infrastructure, ensuring long-term success and self-sufficiency.
> - **Support.** Benefit from a seamless communication over Slack with our experts, ensuring you have the support you need, whenever you need it.
> - **Troubleshooting.** Access expert assistance to quickly resolve any operational challenges, minimizing downtime and maintaining business continuity.
> - **Code Reviews.** Enhance your teamβs code quality with our expert feedback, fostering continuous improvement and collaboration.
> - **Bug Fixes.** Rely on our team to troubleshoot and resolve any issues, ensuring your systems run smoothly.
> - **Migration Assistance.** Accelerate your migration process with our dedicated support, minimizing disruption and speeding up time-to-value.
> - **Customer Workshops.** Engage with our team in weekly workshops, gaining insights and strategies to continuously improve and innovate.
>
>
>
## β¨ Contributing
This project is under active development, and we encourage contributions from our community.
Many thanks to our outstanding contributors:
For π bug reports & feature requests, please use the [issue tracker](https://github.com/cloudposse/terraform-provider-utils/issues).
In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.
1. Review our [Code of Conduct](https://github.com/cloudposse/terraform-provider-utils/?tab=coc-ov-file#code-of-conduct) and [Contributor Guidelines](https://github.com/cloudposse/.github/blob/main/CONTRIBUTING.md).
2. **Fork** the repo on GitHub
3. **Clone** the project to your own machine
4. **Commit** changes to your own branch
5. **Push** your work back up to your fork
6. Submit a **Pull Request** so that we can review your changes
**NOTE:** Be sure to merge the latest changes from "upstream" before making a pull request!
### π Slack Community
Join our [Open Source Community](https://cpco.io/slack?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-provider-utils&utm_content=slack) on Slack. It's **FREE** for everyone! Our "SweetOps" community is where you get to talk with others who share a similar vision for how to rollout and manage infrastructure. This is the best place to talk shop, ask questions, solicit feedback, and work together as a community to build totally *sweet* infrastructure.
### π° Newsletter
Sign up for [our newsletter](https://cpco.io/newsletter?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-provider-utils&utm_content=newsletter) and join 3,000+ DevOps engineers, CTOs, and founders who get insider access to the latest DevOps trends, so you can always stay in the know.
Dropped straight into your Inbox every week β and usually a 5-minute read.
[Join us every Wednesday via Zoom](https://cloudposse.com/office-hours?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-provider-utils&utm_content=office_hours) for your weekly dose of insider DevOps trends, AWS news and Terraform insights, all sourced from our SweetOps community, plus a _live Q&A_ that you canβt find anywhere else.
It's **FREE** for everyone!
## License
Preamble to the Apache License, Version 2.0
Complete license is available in the [`LICENSE`](LICENSE) file.
```text
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
```
## Trademarks
All other trademarks referenced herein are the property of their respective owners.
## Copyrights
Copyright Β© 2021-2024 [Cloud Posse, LLC](https://cloudposse.com)
