terraform

How can I start a remote service using Terraform provisioning?

寵の児 提交于 2020-06-24 07:21:53
问题 I want my Terraform config to provision a server and start the service at the end by invoking a command and keep running it. I tried using nohup and screen using remote-exec: nohup: provisioner "remote-exec" { inline = "nohup sudo command &" } screen: provisioner "remote-exec" { inline = "screen -d -m sudo command" } I check if the commands are running by logging in manually. But they do not keep a process running. These commands do work if I try them manually and invoking them with ssh also

Defining Azure VM CustomScriptExtension in Terraform (Expecting state 'Element'.. Encountered 'Text' with name '', namespace ''. \“.”)

不想你离开。 提交于 2020-06-18 15:39:46
问题 I defined a CustomScriptExtension for Azure VM in Terraform: resource "azurerm_virtual_machine_extension" "test" { name = "WinRM" location = "South Central US" resource_group_name = "${azurerm_resource_group.test.name}" virtual_machine_name = "${azurerm_virtual_machine.test.name}" publisher = "Microsoft.Compute" type = "CustomScriptExtension" type_handler_version = "1.8" settings = <<SETTINGS { "fileUris": "https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts

Defining Azure VM CustomScriptExtension in Terraform (Expecting state 'Element'.. Encountered 'Text' with name '', namespace ''. \“.”)

跟風遠走 提交于 2020-06-18 15:39:05
问题 I defined a CustomScriptExtension for Azure VM in Terraform: resource "azurerm_virtual_machine_extension" "test" { name = "WinRM" location = "South Central US" resource_group_name = "${azurerm_resource_group.test.name}" virtual_machine_name = "${azurerm_virtual_machine.test.name}" publisher = "Microsoft.Compute" type = "CustomScriptExtension" type_handler_version = "1.8" settings = <<SETTINGS { "fileUris": "https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts

Trying to add LinuxDiagnostic Azure VM Extension through terraform and getting errors

陌路散爱 提交于 2020-06-17 14:15:36
问题 I am trying to get the LinuxDiagnostic extension to add via terraform. The VM is: azure_image_publisher = "Redhat" azure_image_offer = "RHEL" azure_image_sku = "7.8" My deploy looks like this: resource "azurerm_virtual_machine_extension" "diagnostics_linux" { count = local.is_windows == true ? 0 : 1 name = "LinuxDiagnostic" virtual_machine_id = azurerm_virtual_machine.main.id publisher = "Microsoft.Azure.Diagnostics" type = "LinuxDiagnostic" type_handler_version = "3.0" auto_upgrade_minor

Terraform import AWS Batch job definition from another project

偶尔善良 提交于 2020-06-17 09:41:44
问题 I have multiple projects, each with their own Terraform to manage the AWS infrastructure specific to that project. Infrastructure that's shared (a VPC for example): I import into the projects that need it. I want to glue together a number of different tasks from across different services using step functions, but some of them are Batch jobs. This means I need to specify the job definition ARN in the step function. I can import a job definition but if I later update the project that manages

Terraform Azurerm Recovery Services Vault Backup Policy Format Error

混江龙づ霸主 提交于 2020-06-17 00:45:07
问题 I am trying to create a weekly Azure VM protection policy in Terraform to run on Fridays at 6:30 pm with a retention of 1. TF throws format error related to 'schedule time, schedule days, retention time and retention days' error. I am not exactly sure which parameter has an incorrect value or format. resource "azurerm_recovery_services_vault" "backup_vault" { name = "${var.RG4VM}-recovery-vault" location = "${var.VMLocation}" resource_group_name = "${var.RG4VM}" sku = "Standard" depends_on =

Terraform Azurerm Recovery Services Vault Backup Policy Format Error

℡╲_俬逩灬. 提交于 2020-06-17 00:45:07
问题 I am trying to create a weekly Azure VM protection policy in Terraform to run on Fridays at 6:30 pm with a retention of 1. TF throws format error related to 'schedule time, schedule days, retention time and retention days' error. I am not exactly sure which parameter has an incorrect value or format. resource "azurerm_recovery_services_vault" "backup_vault" { name = "${var.RG4VM}-recovery-vault" location = "${var.VMLocation}" resource_group_name = "${var.RG4VM}" sku = "Standard" depends_on =

terraform copy/upload files to aws ec2 instance

谁说胖子不能爱 提交于 2020-06-16 19:54:09
问题 We have cronjob and shell script which we want to copy or upload to aws ec2 instance while creating instance using terraform. we tried file provisioner : but its not wokring , and read this option does not work with all terraform version provisioner "file" { source = "abc.sh" destination = "/home/ec2-user/basic2.sh" } tried data template file option data "template_file" "userdata_line" { template = <<EOF #!/bin/bash mkdir /home/ec2-user/files2 cd /home/ec2-user/files2 sudo touch basic2.sh

Terraform with azure CLI - error building account

雨燕双飞 提交于 2020-06-16 18:49:05
问题 using the provider block provider "azurerm" { subscription_id = var.subscription_id version = "=1.44" } and after successfully logging in with az login running terraform plan I get the following error: Error: Error building account: Error getting authenticated object ID: Error parsing json result from the Azure CLI: Error waiting for the Azure CLI: exit status 2 on main.tf line 21, in provider "azurerm": 21: provider "azurerm" { UPDATE: If I change the provider block to: provider "azurerm" {

Terraform - Passing type Object as a parameter to Azure Template Deployment

假如想象 提交于 2020-06-15 23:42:07
问题 I am tying to to provision Azure AD Domain Service using Terraform by giving Terraform the Azure ARM template, this is because Terrafrom does not support provisioning Azure AD Domain Service natively. I have exported the ARM Template and it's parameters, one of the parameters is called "notificationSettings" which is a type Object and looks like below : "notificationSettings": { "value": { "notifyGlobalAdmins": "Enabled", "notifyDcAdmins": "Enabled", "additionalRecipients": [] } } Other