Skip to content

Commit 14b2580

Browse files
committed
Added google cloud deployment terraform files
1 parent ae9c974 commit 14b2580

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
variable "bucket_name" {
2+
}
3+
4+
variable "location" {
5+
default = "europe-west2"
6+
}
7+
8+
variable "project" {
9+
}
10+
11+
provider "google" {
12+
project = "${var.project}"
13+
}
14+
15+
resource "google_storage_bucket" "cloud_storage_maven_repo" {
16+
name = "${var.bucket_name}"
17+
location = "${var.location}"
18+
19+
project = "${var.project}"
20+
}
21+
22+
resource "google_project_iam_custom_role" "cloud_storage_maven_role" {
23+
role_id = "${replace(var.bucket_name,"-","_")}Role"
24+
title = "${var.bucket_name}Role"
25+
description = "Cloud Storage Maven Repository Bucket Role"
26+
permissions = ["storage.objects.create","storage.objects.get","storage.objects.list"]
27+
}
28+
29+
resource "google_service_account" "cloud_storage_service_account" {
30+
account_id = "${var.bucket_name}-sa"
31+
display_name = "${var.bucket_name}ServiceAccount"
32+
}
33+
34+
resource "google_service_account_iam_binding" "cloud_storage_maven_service_account_iam_policy" {
35+
service_account_id = "${google_service_account.cloud_storage_service_account.id}"
36+
role = "${google_project_iam_custom_role.cloud_storage_maven_role.id}"
37+
members = [
38+
"serviceAccount:${google_service_account.cloud_storage_service_account.email}"
39+
]
40+
}

0 commit comments

Comments
 (0)