Skip to content

Commit

Permalink
storage object
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesWoolfenden committed Sep 1, 2022
1 parent d89c600 commit 4028483
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 12 deletions.
3 changes: 3 additions & 0 deletions src/files_gcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ var googleComputeInstance []byte

//go:embed mapping/gcp/resource/storage/google_storage_bucket.json
var googleStorageBucket []byte

//go:embed mapping/gcp/resource/storage/google_storage_bucket_object.json
var googleStorageBucketObject []byte
5 changes: 3 additions & 2 deletions src/gcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ func GetGCPPermissions(result ResourceV2) []string {
// GetGCPResourcePermissions looks up permissions required for resources
func GetGCPResourcePermissions(result ResourceV2) []string {
TFLookup := map[string]interface{}{
"google_compute_instance": googleComputeInstance,
"google_storage_bucket": googleStorageBucket,
"google_compute_instance": googleComputeInstance,
"google_storage_bucket": googleStorageBucket,
"google_storage_bucket_object": googleStorageBucketObject,
}

var Permissions []string
Expand Down
18 changes: 18 additions & 0 deletions src/mapping/gcp/resource/storage/google_storage_bucket_object.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[
{
"apply": [
"storage.objects.create",
"storage.objects.delete"
],
"attributes": {
"tags": []
},
"destroy": [
"storage.objects.delete"
],
"modify": [
"storage.objects.get"
],
"plan": []
}
]
12 changes: 12 additions & 0 deletions terraform/gcp/backup/google_storage_bucket_object.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
resource "google_storage_bucket_object" "object" {
name = basename(var.sourcezip)
bucket = "pike-central"
storage_class = "STANDARD"
kms_key_name = "projects/examplea/locations/us-central1/keyRings/pike-us/cryptoKeys/pike/cryptoKeyVersions/1"
source = var.sourcezip

}

variable "sourcezip" {
default = "main_test.zip"
}
Binary file added terraform/gcp/backup/main_test.zip
Binary file not shown.
7 changes: 3 additions & 4 deletions terraform/gcp/role/google_project_iam_custom_role.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ resource "google_project_iam_custom_role" "pike" {
title = "pike terraform user"
description = "A user with least privileges"
permissions = [
"storage.buckets.create",
"storage.buckets.get",
"storage.buckets.delete",
"storage.objects.create",
"storage.objects.delete",

"storage.buckets.update"
"storage.objects.get"
]
}
6 changes: 0 additions & 6 deletions todo_gcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,3 @@
google_storage_bucket_acl not implemented
google_storage_bucket_acl not implemented
google_storage_bucket_iam_binding not implemented
google_storage_bucket_object not implemented
google_storage_bucket_object not implemented
google_storage_bucket_object not implemented
google_storage_bucket_object not implemented
google_storage_bucket_object not implemented
google_storage_bucket_object not implemented

0 comments on commit 4028483

Please sign in to comment.