Skip to content

Commit

Permalink
No public description
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 581319687
  • Loading branch information
sjswerdlow committed Sep 4, 2024
1 parent 84eefce commit 8050787
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 30 deletions.
12 changes: 7 additions & 5 deletions modules/s4/ansible.tf
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,13 @@ resource "google_compute_instance" "sapdansible11" {

machine_type = "n1-standard-16"
metadata = {
active_region = true
dns_zone_name = "${data.google_dns_managed_zone.sap_zone.name}"
media_bucket_name = "${var.media_bucket_name}"
ssh-keys = ""
startup-script = "gsutil cp ${var.primary_startup_url} ./local_startup.sh; bash local_startup.sh ${var.package_location} ${var.deployment_name}"
active_region = true
configuration_bucket_name = "${data.google_storage_bucket.configuration.name}"
dns_zone_name = "${data.google_dns_managed_zone.sap_zone.name}"
is_test = "${var.is_test}"
media_bucket_name = "${var.media_bucket_name}"
ssh-keys = ""
startup-script = "gsutil cp ${var.primary_startup_url} ./local_startup.sh; bash local_startup.sh ${var.package_location} ${var.deployment_name}"
}
name = "${var.deployment_name}-ansible-runner"
network_interface {
Expand Down
17 changes: 7 additions & 10 deletions modules/s4/configuration_buckets.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.

resource "google_storage_bucket" "configuration" {
force_destroy = true
location = "US"
name = "${var.gcp_project_id}-${var.deployment_name}-configuration"
project = data.google_project.sap-project.project_id
storage_class = "MULTI_REGIONAL"
uniform_bucket_level_access = true
data "google_storage_bucket" "configuration" {
name = var.configuration_bucket_name == "" ? "${var.gcp_project_id}-${var.deployment_name}-configuration" : var.configuration_bucket_name
}

resource "google_storage_bucket_iam_binding" "objectviewer_configuration" {
bucket = google_storage_bucket.configuration.name
bucket = data.google_storage_bucket.configuration.name
members = [
"serviceAccount:${google_service_account.service_account_ansible.email}"
]
role = "roles/storage.objectViewer"
}

resource "google_storage_bucket_object" "ansible_inventory" {
bucket = google_storage_bucket.configuration.name
bucket = data.google_storage_bucket.configuration.name
content = jsonencode({
"ansible_runner" : {
"children" : {
Expand All @@ -50,7 +45,9 @@ resource "google_storage_bucket_object" "ansible_inventory" {
},
"gce_instance_metadata" : {
"active_region" : true,
"configuration_bucket_name" : "${data.google_storage_bucket.configuration.name}",
"dns_zone_name" : "${data.google_dns_managed_zone.sap_zone.name}",
"is_test" : "${var.is_test}",
"media_bucket_name" : "${var.media_bucket_name}",
"startup-script" : "gsutil cp ${var.primary_startup_url} ./local_startup.sh; bash local_startup.sh ${var.package_location} ${var.deployment_name}"
},
Expand Down Expand Up @@ -192,5 +189,5 @@ resource "google_storage_bucket_object" "ansible_inventory" {
}
}
})
name = "wlm.${var.deployment_name}.yml"
name = var.configuration_bucket_name == "" ? "wlm.${var.deployment_name}.yml" : "${var.gcp_project_id}-${var.deployment_name}-configuration/wlm.${var.deployment_name}.yml"
}
23 changes: 23 additions & 0 deletions modules/s4/configuration_optional_buckets.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

resource "google_storage_bucket" "configuration" {
count = var.configuration_bucket_name == "" ? 1 : 0
force_destroy = true
location = "US"
name = "${var.gcp_project_id}-${var.deployment_name}-configuration"
project = data.google_project.sap-project.project_id
storage_class = "MULTI_REGIONAL"
uniform_bucket_level_access = true
}
10 changes: 10 additions & 0 deletions modules/s4/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ variable "ascs_machine_type" {
description = "ascs_machine_type"
}

variable "configuration_bucket_name" {
default = ""
description = "configuration_bucket_name"
}

variable "db_disk_export_backup_size" {
default = 128
description = "db_disk_export_backup_size"
Expand Down Expand Up @@ -144,6 +149,11 @@ variable "hana_secret_name" {
description = "hana_secret_name"
}

variable "is_test" {
default = "false"
description = "is_test"
}

variable "media_bucket_name" {
description = "media_bucket_name"
}
Expand Down
12 changes: 7 additions & 5 deletions modules/s4_ha/ansible.tf
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,13 @@ resource "google_compute_instance" "sapdansible11" {

machine_type = "n1-standard-16"
metadata = {
active_region = true
dns_zone_name = "${data.google_dns_managed_zone.sap_zone.name}"
media_bucket_name = "${var.media_bucket_name}"
ssh-keys = ""
startup-script = "gsutil cp ${var.primary_startup_url} ./local_startup.sh; bash local_startup.sh ${var.package_location} ${var.deployment_name}"
active_region = true
configuration_bucket_name = "${data.google_storage_bucket.configuration.name}"
dns_zone_name = "${data.google_dns_managed_zone.sap_zone.name}"
is_test = "${var.is_test}"
media_bucket_name = "${var.media_bucket_name}"
ssh-keys = ""
startup-script = "gsutil cp ${var.primary_startup_url} ./local_startup.sh; bash local_startup.sh ${var.package_location} ${var.deployment_name}"
}
name = "${var.deployment_name}-ansible-runner"
network_interface {
Expand Down
17 changes: 7 additions & 10 deletions modules/s4_ha/configuration_buckets.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.

resource "google_storage_bucket" "configuration" {
force_destroy = true
location = "US"
name = "${var.gcp_project_id}-${var.deployment_name}-configuration"
project = data.google_project.sap-project.project_id
storage_class = "MULTI_REGIONAL"
uniform_bucket_level_access = true
data "google_storage_bucket" "configuration" {
name = var.configuration_bucket_name == "" ? "${var.gcp_project_id}-${var.deployment_name}-configuration" : var.configuration_bucket_name
}

resource "google_storage_bucket_iam_binding" "objectviewer_configuration" {
bucket = google_storage_bucket.configuration.name
bucket = data.google_storage_bucket.configuration.name
members = [
"serviceAccount:${google_service_account.service_account_ansible.email}"
]
role = "roles/storage.objectViewer"
}

resource "google_storage_bucket_object" "ansible_inventory" {
bucket = google_storage_bucket.configuration.name
bucket = data.google_storage_bucket.configuration.name
content = jsonencode({
"ansible_runner" : {
"children" : {
Expand All @@ -50,7 +45,9 @@ resource "google_storage_bucket_object" "ansible_inventory" {
},
"gce_instance_metadata" : {
"active_region" : true,
"configuration_bucket_name" : "${data.google_storage_bucket.configuration.name}",
"dns_zone_name" : "${data.google_dns_managed_zone.sap_zone.name}",
"is_test" : "${var.is_test}",
"media_bucket_name" : "${var.media_bucket_name}",
"startup-script" : "gsutil cp ${var.primary_startup_url} ./local_startup.sh; bash local_startup.sh ${var.package_location} ${var.deployment_name}"
},
Expand Down Expand Up @@ -303,5 +300,5 @@ resource "google_storage_bucket_object" "ansible_inventory" {
}
}
})
name = "wlm.${var.deployment_name}.yml"
name = var.configuration_bucket_name == "" ? "wlm.${var.deployment_name}.yml" : "${var.gcp_project_id}-${var.deployment_name}-configuration/wlm.${var.deployment_name}.yml"
}
23 changes: 23 additions & 0 deletions modules/s4_ha/configuration_optional_buckets.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

resource "google_storage_bucket" "configuration" {
count = var.configuration_bucket_name == "" ? 1 : 0
force_destroy = true
location = "US"
name = "${var.gcp_project_id}-${var.deployment_name}-configuration"
project = data.google_project.sap-project.project_id
storage_class = "MULTI_REGIONAL"
uniform_bucket_level_access = true
}
10 changes: 10 additions & 0 deletions modules/s4_ha/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ variable "ascs_machine_type" {
description = "ascs_machine_type"
}

variable "configuration_bucket_name" {
default = ""
description = "configuration_bucket_name"
}

variable "db_disk_export_backup_size" {
default = 128
description = "db_disk_export_backup_size"
Expand Down Expand Up @@ -159,6 +164,11 @@ variable "hana_secret_name" {
description = "hana_secret_name"
}

variable "is_test" {
default = "false"
description = "is_test"
}

variable "media_bucket_name" {
description = "media_bucket_name"
}
Expand Down

0 comments on commit 8050787

Please sign in to comment.