Skip to content

Commit 5fc1b25

Browse files
authored
Merge pull request #28 from Datatamer/pre-start_script
DSD-2264: allow users to pass pre-start script
2 parents 22f323f + 186b329 commit 5fc1b25

File tree

6 files changed

+26
-1
lines changed

6 files changed

+26
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
# GCP Tamr VM module
22

3+
## v2.2.0 - May 1st 2023
4+
* Following optional input variables now available
5+
* pre_install_bash
6+
* Allow users to supply custom script to prepare VM
7+
38
## v2.1.1 - April 28th 2023
49
* Startup script checks for the correct unify start script
510
* Startup script avoids permission errors in creating custom config
611

12+
713
## v2.1.0 - April 25th 2023
814
* Following optional input variables now available
915
* metadata

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ This modules creates:
3939
| tamr\_zip\_uri | gcs location to download tamr zip from | `string` | n/a | yes |
4040
| labels | labels to attach to created resources | `map(string)` | `{}` | no |
4141
| metadata | custom metadata to attach to created VM | `map(string)` | `{}` | no |
42+
| pre\_install\_bash | Bash to be run before Tamr is installed.<br> Likely to be used to meet Tamr's prerequisites, if not already met by the image. (https://docs.tamr.com/new/docs/requirements )<br> This will only be run once before Tamr is installed, unless Tamr fails to install. This bash will also be run on subsequent attempts to install Tamr, so it is recommended that this bash is idempotent. | `string` | `""` | no |
4243
| tamr\_external\_ip | Create and attach an external ip to tamr VM | `bool` | `false` | no |
4344
| tamr\_instance\_deletion\_protection | Enabled deletion protection for the tamr VM | `bool` | `true` | no |
4445
| tamr\_instance\_disk\_size | size of the boot disk | `number` | `100` | no |

VERSION

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
2.1.1
1+
2.2.0
2+

main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ locals {
22
external_ip = var.tamr_external_ip == true ? 1 : 0
33

44
startup_script = templatefile("${path.module}/templates/startup_script.sh.tmpl", {
5+
pre_install_bash = var.pre_install_bash
56
tamr_zip_uri = var.tamr_zip_uri
67
tamr_config = var.tamr_config_file
78
tamr_home_directory = var.tamr_instance_install_directory

templates/startup_script.sh.tmpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,14 @@ ${tamr_config}
1212
EOF
1313
)
1414

15+
16+
1517
# check if tamr has been installed on the VM, if not download and install it
1618
if [[ ! -f ${tamr_home_directory}/tamr/start-unify.sh ]]; then
19+
# run any custom commands to prepare VM
20+
%{ if pre_install_bash }
21+
${pre_install_bash}
22+
%{ endif }
1723
# download tamr install
1824
sudo -S -u tamr -i /bin/bash -c 'gsutil cp ${tamr_zip_uri} ${tamr_home_directory}/unify.zip'
1925
# unzip and install unify

variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,16 @@ variable "tamr_config_file" {
102102
description = "Override generated tamr configuration. The tamr configuration is specified using a yaml file, in the format that is documented (https://docs.tamr.com/previous/docs/configuration-configuring-unify#section-setting-configuration-variables) for configuring “many variables” at once."
103103
}
104104

105+
variable "pre_install_bash" {
106+
default = ""
107+
type = string
108+
description = <<EOF
109+
Bash to be run before Tamr is installed.
110+
Likely to be used to meet Tamr's prerequisites, if not already met by the image. (https://docs.tamr.com/new/docs/requirements )
111+
This will only be run once before Tamr is installed, unless Tamr fails to install. This bash will also be run on subsequent attempts to install Tamr, so it is recommended that this bash is idempotent.
112+
EOF
113+
}
114+
105115
#
106116
# file system
107117
#

0 commit comments

Comments
 (0)