Skip to content

Commit f3e929e

Browse files
authored
Google backends: gcs and firestore (#35)
1 parent 117aca4 commit f3e929e

File tree

15 files changed

+196027
-95206
lines changed

15 files changed

+196027
-95206
lines changed

README.md

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,46 @@ Again set the `component`, `stack`, `planPath`, and `action` in the same manner
130130
cosmosEndpoint: "https://my-cosmo-account.documents.azure.com:443/"
131131
```
132132

133+
## Google Cloud
134+
135+
This action supports Google Cloud Platform (GCP). In GCP, we store Terraform plan files in Google Cloud Storage and metadata in Firestore.
136+
137+
To use the GCP implementation, specify `planRepositoryType` as `gcs` and `metadataRepositoryType` as `firestore`, then provide the following GCP-specific settings: `googleProjectId` to specify the project for both GCS bucket and Firestore, `bucketName` for GCS storage, and `googleFirestoreDatabaseName`/`googleFirestoreCollectionName` for Firestore metadata.
138+
139+
The `component`, `stack`, `planPath`, and `action` parameters work the same way as in AWS and Azure examples.
140+
141+
```yaml
142+
- name: Store Plan
143+
uses: cloudposse/github-action-terraform-plan-storage@v1
144+
id: store-plan
145+
with:
146+
action: storePlan
147+
planPath: my-plan.tfplan
148+
component: mycomponent
149+
stack: core-mycomponent-use1
150+
planRepositoryType: gcs
151+
metadataRepositoryType: firestore
152+
bucketName: my-terraform-plans
153+
gcpProjectId: my-gcp-project
154+
gcpFirestoreDatabaseName: terraform-plan-metadata
155+
gcpFirestoreCollectionName: terraform-plan-storage
156+
157+
- name: Get Plan
158+
uses: cloudposse/github-action-terraform-plan-storage@v1
159+
id: get-plan
160+
with:
161+
action: getPlan
162+
planPath: my-plan.tfplan
163+
component: mycomponent
164+
stack: core-mycomponent-use1
165+
planRepositoryType: gcs
166+
metadataRepositoryType: firestore
167+
bucketName: my-terraform-plans
168+
gcpProjectId: my-gcp-project
169+
gcpFirestoreDatabaseName: terraform-plan-metadata
170+
gcpFirestoreCollectionName: terraform-plan-storage
171+
```
172+
133173
> [!IMPORTANT]
134174
> In Cloud Posse's examples, we avoid pinning modules to specific versions to prevent discrepancies between the documentation
135175
> and the latest released versions. However, for your own projects, we strongly advise pinning each module to the exact version
@@ -152,17 +192,20 @@ Again set the `component`, `stack`, `planPath`, and `action` in the same manner
152192
| action | which action to perform. Valid values are: 'storePlan', 'getPlan', 'taintPlan' | storePlan | true |
153193
| blobAccountName | the name of the Azure Blob Storage account to store the plan file | N/A | false |
154194
| blobContainerName | the name of the Azure Blob Storage container to store the plan file | N/A | false |
155-
| bucketName | the name of the S3 bucket to store the plan file | terraform-plan-storage | false |
195+
| bucketName | the name of the S3 or GCS bucket to store the plan file | terraform-plan-storage | false |
156196
| commitSHA | Commit SHA to use for fetching plan | | false |
157197
| component | the name of the component corresponding to the plan file | N/A | false |
158198
| cosmosConnectionString | the connection string to the CosmosDB account to store the metadata | N/A | false |
159199
| cosmosContainerName | the name of the CosmosDB container to store the metadata | N/A | false |
160200
| cosmosDatabaseName | the name of the CosmosDB database to store the metadata | N/A | false |
161201
| cosmosEndpoint | the endpoint of the CosmosDB account to store the metadata | N/A | false |
162202
| failOnMissingPlan | Fail if plan is missing | true | false |
163-
| metadataRepositoryType | the type of repository where the plan file is stored. Valid values are: 'dynamo', 'cosmodb' | dynamo | false |
203+
| gcpFirestoreCollectionName | the name of the Firestore collection to store the metadata | terraform-plan-storage | false |
204+
| gcpFirestoreDatabaseName | the name of the Firestore database to store the metadata | (default) | false |
205+
| gcpProjectId | the Google Cloud project ID for GCP services (GCS, Firestore) | N/A | false |
206+
| metadataRepositoryType | the type of repository where the plan file is stored. Valid values are: 'dynamo', 'cosmodb', 'firestore' | dynamo | false |
164207
| planPath | path to the Terraform plan file. Required for 'storePlan' and 'getPlan' actions | N/A | false |
165-
| planRepositoryType | the type of repository where the metadata is stored. Valid values are: 's3', 'azureblob' | s3 | false |
208+
| planRepositoryType | the type of repository where the metadata is stored. Valid values are: 's3', 'azureblob', 'gcs' | s3 | false |
166209
| stack | the name of the stack corresponding to the plan file | N/A | false |
167210
| tableName | the name of the dynamodb table to store metadata | terraform-plan-storage | false |
168211

README.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,46 @@ usage: |-
119119
cosmosEndpoint: "https://my-cosmo-account.documents.azure.com:443/"
120120
```
121121
122+
## Google Cloud
123+
124+
This action supports Google Cloud Platform (GCP). In GCP, we store Terraform plan files in Google Cloud Storage and metadata in Firestore.
125+
126+
To use the GCP implementation, specify `planRepositoryType` as `gcs` and `metadataRepositoryType` as `firestore`, then provide the following GCP-specific settings: `googleProjectId` to specify the project for both GCS bucket and Firestore, `bucketName` for GCS storage, and `googleFirestoreDatabaseName`/`googleFirestoreCollectionName` for Firestore metadata.
127+
128+
The `component`, `stack`, `planPath`, and `action` parameters work the same way as in AWS and Azure examples.
129+
130+
```yaml
131+
- name: Store Plan
132+
uses: cloudposse/github-action-terraform-plan-storage@v1
133+
id: store-plan
134+
with:
135+
action: storePlan
136+
planPath: my-plan.tfplan
137+
component: mycomponent
138+
stack: core-mycomponent-use1
139+
planRepositoryType: gcs
140+
metadataRepositoryType: firestore
141+
bucketName: my-terraform-plans
142+
gcpProjectId: my-gcp-project
143+
gcpFirestoreDatabaseName: terraform-plan-metadata
144+
gcpFirestoreCollectionName: terraform-plan-storage
145+
146+
- name: Get Plan
147+
uses: cloudposse/github-action-terraform-plan-storage@v1
148+
id: get-plan
149+
with:
150+
action: getPlan
151+
planPath: my-plan.tfplan
152+
component: mycomponent
153+
stack: core-mycomponent-use1
154+
planRepositoryType: gcs
155+
metadataRepositoryType: firestore
156+
bucketName: my-terraform-plans
157+
gcpProjectId: my-gcp-project
158+
gcpFirestoreDatabaseName: terraform-plan-metadata
159+
gcpFirestoreCollectionName: terraform-plan-storage
160+
```
161+
122162
# Other files to include in this README from the project folder
123163
include:
124164
- "docs/github-action.md"

action.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ inputs:
1616
description: "the name of the Azure Blob Storage container to store the plan file"
1717
required: false
1818
bucketName:
19-
description: "the name of the S3 bucket to store the plan file"
19+
description: "the name of the S3 or GCS bucket to store the plan file"
2020
required: false
2121
default: "terraform-plan-storage"
2222
commitSHA:
@@ -43,13 +43,13 @@ inputs:
4343
required: false
4444
default: "true"
4545
metadataRepositoryType:
46-
description: "the type of repository where the plan file is stored. Valid values are: 'dynamo', 'cosmodb'"
46+
description: "the type of repository where the plan file is stored. Valid values are: 'dynamo', 'cosmodb', 'firestore'"
4747
required: false
4848
default: "dynamo"
4949
planPath:
5050
description: "path to the Terraform plan file. Required for 'storePlan' and 'getPlan' actions"
5151
planRepositoryType:
52-
description: "the type of repository where the metadata is stored. Valid values are: 's3', 'azureblob'"
52+
description: "the type of repository where the metadata is stored. Valid values are: 's3', 'azureblob', 'gcs'"
5353
required: false
5454
default: "s3"
5555
stack:
@@ -59,6 +59,17 @@ inputs:
5959
description: "the name of the dynamodb table to store metadata"
6060
required: false
6161
default: "terraform-plan-storage"
62+
gcpProjectId:
63+
description: "the Google Cloud project ID for GCP services (GCS, Firestore)"
64+
required: false
65+
gcpFirestoreDatabaseName:
66+
description: "the name of the Firestore database to store the metadata"
67+
required: false
68+
default: "(default)"
69+
gcpFirestoreCollectionName:
70+
description: "the name of the Firestore collection to store the metadata"
71+
required: false
72+
default: "terraform-plan-storage"
6273

6374
outputs: {}
6475
runs:

0 commit comments

Comments
 (0)