-
Notifications
You must be signed in to change notification settings - Fork 0
/
gcp.tf
90 lines (67 loc) · 2.52 KB
/
gcp.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
variable "gcp_project_name" {
description = "The display name of the gcp project to create - required for cloud / content provider = gcp"
type = string
default = "icon-testing"
}
variable "gcp_project_id" {
description = "The name of the gcp project to create - required for cloud / content provider = gcp"
type = string
default = "icon-testing"
}
variable "gcp_website_location" {
description = "(Optional, Default: 'US') The GCS location"
type = string
default = "US"
}
variable "gcp_website_storage_class" {
description = "The Storage Class of the new bucket. Supported values include: STANDARD, MULTI_REGIONAL, REGIONAL, NEARLINE, COLDLINE"
type = string
default = "STANDARD"
}
data "google_client_config" "current" {
count = var.details_endpoint == "" && ! var.skip_registration ? 1 : 0
}
resource "google_compute_address" "this" {
count = var.details_endpoint == "" && ! var.skip_registration ? 1 : 0
name = local.bucket_name
}
resource "google_storage_bucket" "this" {
count = var.details_endpoint == "" && ! var.skip_registration ? 1 : 0
name = local.bucket_name
location = "US"
force_destroy = true
versioning {
enabled = true
}
labels = var.labels
}
resource "google_storage_default_object_acl" "website_acl" {
count = var.details_endpoint == "" && ! var.skip_registration ? 1 : 0
provider = google-beta
bucket = join("", google_storage_bucket.this.*.id)
role_entity = ["READER:allUsers"]
}
resource "google_storage_bucket_object" "logo_256" {
count = var.logo_256 != "" && var.details_endpoint == "" && ! var.skip_registration ? 1 : 0
bucket = join("", google_storage_bucket.this.*.id)
name = basename(var.logo_256)
source = var.logo_256
}
resource "google_storage_bucket_object" "logo_1024" {
count = var.logo_1024 != "" && var.details_endpoint == "" && ! var.skip_registration ? 1 : 0
bucket = join("", google_storage_bucket.this.*.id)
name = basename(var.logo_1024)
source = var.logo_1024
}
resource "google_storage_bucket_object" "logo_svg" {
count = var.logo_svg != "" && var.details_endpoint == "" && ! var.skip_registration ? 1 : 0
bucket = join("", google_storage_bucket.this.*.id)
name = basename(var.logo_svg)
source = var.logo_256
}
resource "google_storage_bucket_object" "details_json" {
count = var.details_endpoint == "" && ! var.skip_registration ? 1 : 0
bucket = join("", google_storage_bucket.this.*.id)
name = "details.json"
content = module.registration.details_content
}