terraform

How do I create custom Azure images smaller than 30GB with Packer + Terraform?

﹥>﹥吖頭↗ 提交于 2020-04-30 10:01:17
问题 I want to create custom images that are 4GB for cost-saving purposes on a side project. I've been able set the size for the Azure-provided Ubuntu 18.04 base image in Terraform successfully using the following: resource "azurerm_managed_disk" "example-disk" { ... create_option = "FromImage" disk_size_gb = "4" } resource "azurerm_virtual_machine" "example" { ... vm_size = "Standard_B1s" storage_image_reference { publisher = "Canonical" offer = "UbuntuServer" sku = "18.04-LTS" version = "latest"

Terraform creating VM from managed disk image

99封情书 提交于 2020-04-30 09:16:56
问题 I wish to get a marketplace image to a managed disk and then have this managed disk attached to a Azure virtual machine with Terraform. This enables the change of the virtual machine configuration where a destroy and rebuild leaves the virtual machine intact. I have found people with similar problems but the issues get closed off with no example left of how to get this achieved. For the platform image data "azurerm_platform_image" "2016-Datacenter" { location = "West Europe" publisher =

Terraform creating VM from managed disk image

巧了我就是萌 提交于 2020-04-30 09:13:58
问题 I wish to get a marketplace image to a managed disk and then have this managed disk attached to a Azure virtual machine with Terraform. This enables the change of the virtual machine configuration where a destroy and rebuild leaves the virtual machine intact. I have found people with similar problems but the issues get closed off with no example left of how to get this achieved. For the platform image data "azurerm_platform_image" "2016-Datacenter" { location = "West Europe" publisher =

Terraform back-end to azure blob storage errors

喜夏-厌秋 提交于 2020-04-13 07:50:47
问题 I have been using the below to successfully create a back-end state file for terraform in Azure storage, but for some reason its stopped working. I've recycled passwords for the storage, trying both keys and get the same error every-time backend.tf terraform { backend "azurerm" { storage_account_name = "terraformstorage" resource_group_name = "automation" container_name = "terraform" key = "testautomation.terraform.tfstate" access_key = "<storage key>" } } Error returned terraform init

terraform > forces new resource on security group

南笙酒味 提交于 2020-04-10 20:32:12
问题 I've got a very simple piece of Terraform code: provider "aws" { region = "eu-west-1" } module ec2 { source = "./ec2_instance" name = "EC2 Instance 1" } where the module is: variable "name" { default = "Default Name from ec2_instance.tf" } resource "aws_instance" "example" { ami = "ami-e5083683" instance_type = "t2.nano" subnet_id = "subnet-3e976259" associate_public_ip_address = true security_groups = [ "sg-7310e10b" ] tags { Name = "${var.name}" } } When I first run it I get this output:

terraform > forces new resource on security group

牧云@^-^@ 提交于 2020-04-10 20:30:43
问题 I've got a very simple piece of Terraform code: provider "aws" { region = "eu-west-1" } module ec2 { source = "./ec2_instance" name = "EC2 Instance 1" } where the module is: variable "name" { default = "Default Name from ec2_instance.tf" } resource "aws_instance" "example" { ami = "ami-e5083683" instance_type = "t2.nano" subnet_id = "subnet-3e976259" associate_public_ip_address = true security_groups = [ "sg-7310e10b" ] tags { Name = "${var.name}" } } When I first run it I get this output:

terraform > forces new resource on security group

僤鯓⒐⒋嵵緔 提交于 2020-04-10 20:26:34
问题 I've got a very simple piece of Terraform code: provider "aws" { region = "eu-west-1" } module ec2 { source = "./ec2_instance" name = "EC2 Instance 1" } where the module is: variable "name" { default = "Default Name from ec2_instance.tf" } resource "aws_instance" "example" { ami = "ami-e5083683" instance_type = "t2.nano" subnet_id = "subnet-3e976259" associate_public_ip_address = true security_groups = [ "sg-7310e10b" ] tags { Name = "${var.name}" } } When I first run it I get this output:

How to use a token created in a secret in another resource?

╄→尐↘猪︶ㄣ 提交于 2020-04-07 08:03:23
问题 I'm trying to create a service account secret in order to populate a secret with the token: resource "kubernetes_service_account" "k8s-api-token" { metadata { namespace = "${var.whatever_namespace}" name = "api-service-account" } secret { name = "api-service-account-secret" } } resource "kubernetes_secret" "k8s-api-token" { metadata { namespace = "${var.whatever_namespace}" name = "${kubernetes_service_account.k8s-api-token.metadata.0.name}-secret" annotations = { "kubernetes.io/service

Terraform Custom Provider - Data Source

橙三吉。 提交于 2020-04-06 04:12:12
问题 I am currently working on a custom Terraform Provider for Jumpcloud and am experiencing some challenges with configuring a custom data source. I see that the Resource schema requires Create, Read, Update, and delete. I am just wanting to run an API query in Terraform so that I can return a list of users and use those users in a for loop. Below is the API call that I have tagged as a schema.Resource func userquery() *schema.Resource { apiKey := "" userGroupID := "" contentType := "application

How to add Virtual Machine User Login roles to a list of users by Terraform?

南笙酒味 提交于 2020-03-25 16:16:15
问题 a@cc.com & b@cc.com are E-mail addresses of our organization. These emails are also used as the Azure login accounts. I've set up a Terraform code to use the AzureAD to access to the VM in Azrue. My question is How Can I grand those accounts the role of Virtual Machine User Login ? resource "azurerm_role_assignment" "test" { scope = "${data.azurerm_management_group.primary.id}" role_definition_id = "Virtual Machine User Login" principal_id = "a@cc.com, b@cc.com" } The official documents says