RunOnce testing

This commit is contained in:
Justin Donnelly
2020-10-06 01:29:47 +00:00
parent c564e97e51
commit 35b0bb5e78
3 changed files with 35 additions and 17 deletions

View File

@@ -14,6 +14,17 @@ resource "random_id" "vm_suffix" {
byte_length = 2
}
resource "google_compute_disk" "data" {
provider = google-beta
name = "central-datadisk-${random_id.vm_suffix.hex}"
type = var.disk_type
zone = var.zone
# labels = {
# environment = "dev"
# }
size = 50
}
resource "google_compute_instance" "default" {
provider = google-beta
name = "central-${random_id.vm_suffix.hex}"
@@ -31,6 +42,14 @@ resource "google_compute_instance" "default" {
}
}
attached_disk {
source = google_compute_disk.data.name
}
# lifecycle {
# ignore_changes = [attached_disk]
# }
network_interface {
network = "default"
@@ -40,23 +59,14 @@ resource "google_compute_instance" "default" {
}
metadata = {
windows-startup-script-url = "bar"
windows-startup-script-url = "gs://qliksense/scripts/bootstrap.ps1"
}
# metadata_startup_script = "echo hi > /test.txt"
service_account {
scopes = ["userinfo-email", "compute-ro", "storage-ro"]
email = "terraform@esoteric-parsec-243510.iam.gserviceaccount.com"
scopes = ["userinfo-email", "compute-rw", "storage-ro"]
}
provisioner "file" {
source = "../scripts/bootstrap.ps1"
destination = "C:/"
}
provisioner "remote-exec" {
inline = [
"powershell.exe -ExecutionPolicy Bypass -File C:/bootstrap.ps1"
]
}
}

View File

@@ -5,8 +5,8 @@
"private_network": "projects/esoteric-parsec-243510/global/networks/default",
"database_version": "POSTGRES_9_6",
"vm_type": "e2-highmem-4",
"min_cpu": "AMD Rome",
"image": "windows-server-2019-dc-v20200908",
"min_cpu": "Intel Skylake",
"image": "family/windows-2019",
"disk_type": "pd-ssd",
"availability_type": "REGIONAL",
"user_name": "qlikadmin",

View File

@@ -51,14 +51,22 @@ if (-Not (Test-Path $deploy_path)) {
# CLOUDCLI_UPDATE
# OBJCLI_COPY
gcloud components update -Force
# gcloud components update -Force
gsutil cp gs://qliksense/Qlik_Sense* $deploy_path\binaries\
gsutil cp gs://qliksense/ps/ $deploy_path\
gsutil cp gs://qliksense/scripts/ $deploy_path\
gsutil cp gs://qliksense/modules/ps/* $Env:ProgramFiles\WindowsPowerShell\Modules\
# Push-Location $deploy_path\modules\ps
Get-PackageProvider -Name NuGet -ForceBootstrap
# Below will also download and save the QlikResources requirements modules
Save-Module -Path $deploy_path/modules/ps/ -Name QlikResources -RequiredVersion 1.9.2
# Save-Module -Path $deploy_path/modules/ps/ -Name QlikResources -RequiredVersion 1.9.2
# Save-Module -Path $deploy_path/modules/ps/ -Name GoogleCloud
# HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce
# New-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\RunOnce' -Name 'Run' -Value '<insert_script_command_here>'
# $CurrentModPath = [Environment]::GetEnvironmentVariable("PSModulePath", "Machine")
# [Environment]::SetEnvironmentVariable("PSModulePath", $CurrentModPath + [System.IO.Path]::PathSeparator + "E:\deploy", "Machine")
E:\deploy\scripts\win-nfs_client-install.ps1
# Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
# choco install git --no-progress
# Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"