A GitHub Action to securely store Terraform plan files in a cloud storage (S3 or Azure Blob Storage) with metadata storage in cloud document database (DynamoDB or CosmosDB).
Note
This project is part of Cloud Posse's comprehensive "SweetOps" approach towards DevOps.
It's 100% Open Source and licensed under the APACHE2.
A Github Action to securely store Terraform plan files in a cloud storage (S3 or Azure Blob Storage) with metadata storage in cloud document database (DynamoDB or CosmosDB). This is useful in CI/CD pipelines where you want to store the plan files when a feature branch is opened and applied when merged.
- name: Store Plan
uses: cloudposse/github-action-terraform-plan-storage@v1
id: store-plan
with:
action: storePlan
planPath: my-plan.tfplan
component: mycomponent
stack: core-mycomponent-use1
tableName: acme-terraform-plan-metadata
bucketName: acme-terraform-plans
- name: Get Plan
uses: cloudposse/github-action-terraform-plan-storage@v1
id: get-plan
with:
action: getPlan
planPath: my-plan.tfplan
component: mycomponent
stack: core-mycomponent-use1
tableName: acme-terraform-plan-metadata
bucketName: acme-terraform-plans - name: Store Plan
uses: cloudposse/github-action-terraform-plan-storage@v1
id: store-plan
with:
metadataRepositoryType: cosmos
planRepositoryType: azureblob
action: storePlan
planPath: my-plan.tfplan
component: mycomponent
stack: core-mycomponent-use1
blobAccountName: tfplans
blobContainerName: plans
cosmosContainerName: terraform-plan-storage
cosmosDatabaseName: terraform-plan-storage
cosmosEndpoint: "https://my-cosmo-account.documents.azure.com:443/"
- name: Get Plan
uses: cloudposse/github-action-terraform-plan-storage@v1
id: get-plan
with:
metadataRepositoryType: cosmos
planRepositoryType: azureblob
action: getPlan
planPath: my-plan.tfplan
component: mycomponent
stack: core-mycomponent-use1
blobAccountName: tfplans
blobContainerName: plans
cosmosContainerName: terraform-plan-storage
cosmosDatabaseName: terraform-plan-storage
cosmosEndpoint: "https://my-cosmo-account.documents.azure.com:443/"| Name | Description | Default | Required |
|---|---|---|---|
| action | which action to perform. Valid values are: 'storePlan', 'getPlan', 'taintPlan' | storePlan | true |
| blobAccountName | the name of the Azure Blob Storage account to store the plan file | N/A | false |
| blobContainerName | the name of the Azure Blob Storage container to store the plan file | N/A | false |
| bucketName | the name of the S3 bucket to store the plan file | terraform-plan-storage | true |
| commitSHA | Commit SHA to use for fetching plan | false | |
| component | the name of the component corresponding to the plan file | N/A | false |
| cosmosConnectionString | the connection string to the CosmosDB account to store the metadata | N/A | false |
| cosmosContainerName | the name of the CosmosDB container to store the metadata | N/A | false |
| cosmosDatabaseName | the name of the CosmosDB database to store the metadata | N/A | false |
| cosmosEndpoint | the endpoint of the CosmosDB account to store the metadata | N/A | false |
| failOnMissingPlan | Fail if plan is missing | true | false |
| metadataRepositoryType | the type of repository where the plan file is stored. Valid values are: 'dynamo', 'cosmodb' | dynamo | false |
| planPath | path to the Terraform plan file. Required for 'storePlan' and 'getPlan' actions | N/A | false |
| planRepositoryType | the type of repository where the metadata is stored. Valid values are: 's3', 'azureblob' | s3 | false |
| stack | the name of the stack corresponding to the plan file | N/A | false |
| tableName | the name of the dynamodb table to store metadata | terraform-plan-storage | true |
| Name | Description |
|---|
Check out these related projects.
- terraform-null-label - Terraform module designed to generate consistent names and tags for resources. Use terraform-null-label to implement a strict naming convention.
For additional context, refer to some of these links.
This project is under active development, and we encourage contributions from our community. Many thanks to our outstanding contributors:
Please use the issue tracker to report any bugs or file feature requests.
If you are interested in being a contributor and want to get involved in developing this project or help out with Cloud Posse's other projects, we would love to hear from you! Shoot us an email.
In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.
- Fork the repo on GitHub
- Clone the project to your own machine
- Commit changes to your own branch
- Push your work back up to your fork
- 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!
Join our Open Source Community 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.
Sign up for our newsletter that covers everything on our technology radar. Receive updates on what we're up to on GitHub as well as awesome new projects we discover.
Join us every Wednesday via Zoom for our weekly "Lunch & Learn" sessions. It's FREE for everyone!
This project is maintained and funded by Cloud Posse, LLC.
We are a DevOps Accelerator. We'll help you build your cloud infrastructure from the ground up so you can own it. Then we'll show you how to operate it and stick around for as long as you need us.
Work directly with our team of DevOps experts via email, slack, and video conferencing.
We deliver 10x the value for a fraction of the cost of a full-time engineer. Our track record is not even funny. If you want things done right and you need it done FAST, then we're your best bet.
- Reference Architecture. You'll get everything you need from the ground up built using 100% infrastructure as code.
- Release Engineering. You'll have end-to-end CI/CD with unlimited staging environments.
- Site Reliability Engineering. You'll have total visibility into your apps and microservices.
- Security Baseline. You'll have built-in governance with accountability and audit logs for all changes.
- GitOps. You'll be able to operate your infrastructure via Pull Requests.
- Training. You'll receive hands-on training so your team can operate what we build.
- Questions. You'll have a direct line of communication between our teams via a Shared Slack channel.
- Troubleshooting. You'll get help to triage when things aren't working.
- Code Reviews. You'll receive constructive feedback on Pull Requests.
- Bug Fixes. We'll rapidly work with you to fix any bugs in our projects.
See LICENSE for full details.
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.
All other trademarks referenced herein are the property of their respective owners.
Copyright Β© 2022-2024 Cloud Posse, LLC
