diff --git a/src/files_gcp.go b/src/files_gcp.go index 219843a8..dad47b20 100644 --- a/src/files_gcp.go +++ b/src/files_gcp.go @@ -4,5 +4,8 @@ import ( _ "embed" // required for embed ) -//go:embed mapping/gcp/resource/google_compute_instance.json +//go:embed mapping/gcp/resource/compute/google_compute_instance.json var googleComputeInstance []byte + +//go:embed mapping/gcp/resource/storage/google_storage_bucket.json +var googleStorageBucket []byte diff --git a/src/gcp.go b/src/gcp.go index 32912590..f02c52ec 100644 --- a/src/gcp.go +++ b/src/gcp.go @@ -20,6 +20,7 @@ func GetGCPPermissions(result ResourceV2) []string { func GetGCPResourcePermissions(result ResourceV2) []string { TFLookup := map[string]interface{}{ "google_compute_instance": googleComputeInstance, + "google_storage_bucket": googleStorageBucket, } var Permissions []string diff --git a/src/gcp_policy.go b/src/gcp_policy.go index c3091072..3c7173fb 100644 --- a/src/gcp_policy.go +++ b/src/gcp_policy.go @@ -2,7 +2,7 @@ package pike import ( "bytes" - _ "embed" //required for embed + _ "embed" // required for embed "strings" "text/template" ) diff --git a/src/mapping/gcp/resource/google_compute_instance.json b/src/mapping/gcp/resource/compute/google_compute_instance.json similarity index 100% rename from src/mapping/gcp/resource/google_compute_instance.json rename to src/mapping/gcp/resource/compute/google_compute_instance.json diff --git a/src/mapping/gcp/resource/storage/google_storage_bucket.json b/src/mapping/gcp/resource/storage/google_storage_bucket.json new file mode 100644 index 00000000..74e9554b --- /dev/null +++ b/src/mapping/gcp/resource/storage/google_storage_bucket.json @@ -0,0 +1,19 @@ +[ + { + "apply": [ + "storage.buckets.create", + "storage.buckets.get", + "storage.buckets.delete" + ], + "attributes": { + "tags": [] + }, + "destroy": [ + "storage.buckets.delete" + ], + "modify": [ + "storage.buckets.update" + ], + "plan": [] + } +] diff --git a/src/mapping/gcp/resource/template.json b/src/mapping/gcp/resource/template.json new file mode 100644 index 00000000..45e4fdaf --- /dev/null +++ b/src/mapping/gcp/resource/template.json @@ -0,0 +1,11 @@ +[ + { + "apply": [], + "attributes": { + "tags": [] + }, + "destroy": [], + "modify": [], + "plan": [] + } +] diff --git a/terraform/gcp/backup/google_storage_bucket.tf b/terraform/gcp/backup/google_storage_bucket.tf new file mode 100644 index 00000000..52ea6c47 --- /dev/null +++ b/terraform/gcp/backup/google_storage_bucket.tf @@ -0,0 +1,21 @@ +resource "google_storage_bucket" "static-site" { + name = "pike-image-store-com" + location = "EU" + force_destroy = true + storage_class = "STANDARD" + uniform_bucket_level_access = true + labels = { + pike = "permissions" + } + + # website { + # main_page_suffix = "index.html" + # not_found_page = "404.html" + # } + # cors { + # origin = ["http://image-store.com"] + # method = ["GET", "HEAD", "PUT", "POST", "DELETE"] + # response_header = ["*"] + # max_age_seconds = 3600 + # } +} diff --git a/terraform/gcp/role/google_project_iam_custom_role.tf b/terraform/gcp/role/google_project_iam_custom_role.tf index e54cd4ee..97a50e74 100644 --- a/terraform/gcp/role/google_project_iam_custom_role.tf +++ b/terraform/gcp/role/google_project_iam_custom_role.tf @@ -4,15 +4,10 @@ resource "google_project_iam_custom_role" "pike" { title = "pike terraform user" description = "A user with least privileges" permissions = [ - "compute.zones.get", - "compute.instances.create", - "compute.instances.get", - "compute.disks.create", - "compute.disks.create", - "compute.subnetworks.use", - "compute.subnetworks.useExternalIp", - "compute.instances.setMetadata", - "compute.instances.delete", - "compute.instances.setTags" + "storage.buckets.create", + "storage.buckets.get", + "storage.buckets.delete", + + "storage.buckets.update" ] } diff --git a/todo_gcp.md b/todo_gcp.md new file mode 100644 index 00000000..1c087ae5 --- /dev/null +++ b/todo_gcp.md @@ -0,0 +1,71 @@ +# GCP + + data.google_compute_image not implemented + data.google_compute_image not implemented + data.google_compute_image not implemented + data.google_compute_network not implemented + data.google_compute_network not implemented + data.google_compute_network not implemented + data.google_compute_subnetwork not implemented + data.google_compute_zones not implemented + data.google_iam_policy not implemented + data.google_iam_role not implemented + data.google_project not implemented + data.google_project not implemented + data.google_project not implemented + data.google_service_account not implemented + + google_app_engine_standard_app_version not implemented + google_bigquery_dataset not implemented + google_bigquery_job not implemented + google_bigquery_table not implemented + google_cloudfunctions_function not implemented + google_compute_address not implemented + google_compute_address not implemented + google_compute_firewall not implemented + google_compute_firewall not implemented + google_compute_firewall not implemented + google_compute_firewall not implemented + google_compute_global_address not implemented + google_compute_instance_template not implemented + google_compute_instance_template not implemented + google_compute_network not implemented + google_compute_project_metadata_item not implemented + google_compute_region_instance_group_manager not implemented + google_compute_subnetwork not implemented + google_container_cluster not implemented + google_container_node_pool not implemented + google_kms_crypto_key not implemented + google_kms_key_ring not implemented + google_project_iam_binding not implemented + google_project_iam_binding not implemented + google_project_iam_binding not implemented + google_project_iam_binding not implemented + google_project_iam_binding not implemented + google_project_iam_binding not implemented + google_project_iam_member not implemented + google_project_service not implemented + google_project_service not implemented + google_project_service not implemented + google_project_service not implemented + google_project_service not implemented + google_project_service not implemented + google_project_service not implemented + google_project_service not implemented + google_service_account not implemented + google_service_account not implemented + google_service_account_iam_policy not implemented + google_service_account_key not implemented + google_service_networking_connection not implemented + google_sql_database not implemented + google_sql_database_instance not implemented + google_sql_user not implemented + 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