Questions tagged [terraform]
Terraform is a tool for building, changing, and combining infrastructure safely and efficiently.
378
questions
0
votes
0
answers
8
views
My cloud config template file does not seem to be working when I use it to boot up a droplet in Digital Ocean?
I'm using Terraform to spin up a DO droplet, using an Ubuntu and Docker image. Checkout below:
resource "digitalocean_droplet" "web" {
image = "docker-20-04"
name ...
0
votes
1
answer
14
views
How to copy a file to aws ec2 instance and use it in the user-data?
I have an rpm file for an application which is generated daily that I want to install on an EC2 server using user-data of ec2-instance using terraform.
I got file provisioner in a search result, but ...
0
votes
0
answers
8
views
Apply terraform changes to selected resources only
I have a Terraform module that creates a couple dozen servers on an ESXi host, based on a template image.
Now, when running terraform apply it always wants to replace all servers at once. Is there any ...
0
votes
0
answers
11
views
Terraform on a Network Share
I'm having a small issue where Terraform will not run from a network share - It is unable to read or write the lock files.
I am running on a Proxmox homelab with FreeNAS (TrueNAS) mounted to a Ubuntu ...
0
votes
0
answers
11
views
Internal IP is use by HTTP internal load balance, but IP address show "none"
I created an Internal HTTP Load balance by the code below.
I can see Internal HTTP Load balance is running with internal IP(var.my_iip)
But in VPC network > IP addresses, the "in use by" ...
0
votes
0
answers
7
views
How to setup pubsub with secure IAM policy?
I'm trying to setup a bunch of service accounts for another bunch of pubsub topics and subscriptions. What I'm trying to achieve is that each micro service should only be allowed to write to a ...
0
votes
0
answers
22
views
How to deploy terraform in another account of aws using gitlab?
I have a gitlab runner configured in the aws ec2 instance.
For any aws deployments, we simply added the role to the ec2 instance.
But, our gitlab runner is configured in one aws account.
And we need ...
0
votes
1
answer
37
views
Failed to initialize kubernetes configuration when using terraform plan
I've migrated my old terraform install from some 1.0 version (sadly, don't remember which exactly) to latest, installed with nix
terraform -v ...
0
votes
0
answers
82
views
How to pass text file containing list of thousands ip address as a variable while creating aws wafv2 ip set using terraform?
I want to create a aws wafv2 ip set using terraform.I have two text file one is blacklist.txt and another is whitelist.txt
Below are the main.tf and variable.tf files
resource "aws_wafv2_ip_set&...
0
votes
1
answer
20
views
How do I write a maintainable Terraform template
for my company I have been tasked with creating a standard configuration and template for an (EKS) Kubernetes cluster in Terraform that can be deployed using GitLab CI/CD. The deployment and ...
0
votes
0
answers
62
views
Terraform Libvirt - How to use local qcow2 file
i try to provision some nodes for a kubernetes cluster based on kvm and debian. I want to use the Debian 11 Genericcloud Image and clound-init to initialize it. So i put the debian baseimge to /var/...
0
votes
1
answer
60
views
Terraform: How to Detect and Branch on Operating System?
Given this block of pseudo code from Terraform:
resource "null_resource" {
provisioner "local-exec" {
command = "echo hello"
interpreter = local.os == ...
0
votes
0
answers
15
views
azure terraform Linux Vm with Red hat
I am creating a Linux Red hat vm in terrafrom and I am strugling to get the right configuration with red hat and how to custimise the storage and cpu unit in azure and how to use the variables and ...
0
votes
0
answers
7
views
How to automate complete azure kubernetes environment?
We have azure kubernetes cluster and database managed service in postgres azure flexible servers.
Created terraform templates to automate environment setup. But there is no option in azure devops to ...
0
votes
1
answer
225
views
Terraform source Gitlab module
I need help with sourcing terraform modules from a gitlab repository with multiple modules in it like ec2, vpc etc. I have two branches in module repo - develop and main. I tried all the ways below ...
0
votes
1
answer
327
views
How do you SSH in to an Azure VM through an Azure Bastion?
My initial understanding was that an Azure Bastion acts like a lightweight SSH (and RDP) gateway to resources -- specifically, VMs -- on the same virtual network, rather than provisioning a full VM as ...
0
votes
1
answer
288
views
Terraform - Unable to get subnet id
I'm trying to create RDS instance via terraform and I'm having trouble getting subnet id from AWS to create aws_db_subnet_group.
I've tried many methods such as:
data.aws_subnet.test_subnet.id
...
0
votes
1
answer
294
views
Terraform: How to dynamically generate a block of a JSON policy?
I have the following resource:
resource "aws_iam_user_policy" "ses_send_policy" {
count = var.enabled ? 1 : 0
name_prefix = var.user_policy_name_prefix
user = ...
1
vote
1
answer
328
views
Terraform cycle error with AWS EC2 instance, volume and template file
Could you please help to explain and work around this error?
I have the following TF program for an instance with an EBS volume and template file using that volume id:
resource "aws_instance"...
0
votes
0
answers
119
views
How to create azure postgres using terraform?
Created VNet and two subnets first and pass the values as variables to terraform.
az group create -n TestingTFCLI -l CentralUS
az network vnet create -g TestingTFCLI -n myVNET --address-prefixes 10.0....
0
votes
1
answer
94
views
how to fix ProvisioningDisabled for postgres flexible server
I am trying to create a flexible server of postgres and when I tried, the quota exhausted for eastus2. So I tried centralindia and got below error.
Error: waiting for creation of the Postgresql ...
0
votes
1
answer
26
views
How to create service delagation to an existing subnet?
Below code will create a service while creating subnet.
Is there anyway to create a delegation to existing subnet?
The main purpose is, below code will be create error for policy Deny-Subnet-Without-...
0
votes
1
answer
173
views
How to set service_endpoints and delegation in subnet part of vnet in azure using terraform?
I have a working block of terraform vnet,subnet and NSG of it.
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "example" {
name = "...
0
votes
1
answer
64
views
Unable to connect GCP SQL Instance from GKE cluster
I have created a vpc-native cluster and I am trying to connect from a pod inside the cluster to a postgres SQL instance with a private IP.
I am testing using a basic telnet 5432 command.
The ...
0
votes
2
answers
95
views
How to set logic to create multiple machines on azure using terraform? [closed]
Below is the template I have for azure VM.
In Google cloud, we have option to set count for creating multiple machines, as I heard.
How to create multiple machines using a single template, so that ...
0
votes
1
answer
45
views
how to use BASH to convert the path to the home folder in the variable bash, in quotation marks into a working one
Use the script, I am trying to create a directory in my home folder. Due to the specifics of integration with terraforms, parameters are passed in this way:
variable = "value"
It would be ...
0
votes
1
answer
72
views
Separating DNS records into multiple zones for the same domain
I thought it would be a good idea to setup MX records in one zone, while using another zone managed by Terraform (using GCP) to deal with A records and CNAMES for the web server I'm setting up. Both ...
0
votes
1
answer
222
views
Create ingress firewall rule for GKE API
For testing purposes I want to make the GKE API endpoint publicly available.
However, I can't seem to be able to create a firewall rule to allow this.
I receive the error "source_ranges": ...
0
votes
1
answer
221
views
Is it possible to use Terraform and an Azure Key Vault Firewall without having to specify my IP address every time I want to make a change?
I have several VMs in my Azure environment, and each has an associated encryption key. The encryption key is stored in an Azure Key Vault. All of these things are resources in my Terraform scripts. ...
0
votes
0
answers
11
views
Terraform-vsphere work with Cobbler for OS installation
I'm trying to use terraform vsphere to provision vSphere VMs. Now I can create VMs.
resource "vsphere_virtual_machine" "k8s_cp3" {
name = "sat-k8s-cp3"
...
0
votes
0
answers
121
views
cloud-init seems to be ignoring write-files script
H!
I am trying to configure VMs with cloud-init, using the terraform Libvirt provider.
For some reason I don't understand, setting hostname works, but writing and running a script for additional ...
1
vote
2
answers
1k
views
run a script via cloud-init
I know cloud-init allows to run commands as part of the cloud-init yml
runcmd:
- [ pwd ]
but I am looking for a way to execute a full shell script.
Some people just pipe the output of a curl into a ...
0
votes
1
answer
50
views
How to retrieve private key information when we are creating azure vm from terraform?
I have created a linux centos machine on azure cloud using terraform.
I tried to see the content of private key so I can connect later using output variable.
But, I got error as I need to set it as ...
0
votes
2
answers
376
views
Subnet is not creating with terraform on azure, how to fix it?
I am trying to create two centos 8 machines with terraform on azure.
My templates github link
When I try to apply, I am getting below error related to policy.
Could you please suggest how to fix this?
...
0
votes
0
answers
39
views
How to debug FAILED - RETRYING: wait for hosts (12 retries left)
Trying to deploy a VM landscape using https://github.com/GoogleCloudPlatform/sap-deployment-automation, I often get the message:
FAILED - RETRYING: wait for hosts (12 retries left).
It usually ...
0
votes
1
answer
339
views
Unable to SSH into a Terraform-created EC2 instance
Using Terraform v1.0.11 on Ubuntu 18.04
After a terraform apply with the main.tf below, and after waiting for the instance to pass checks (and then another minute), attempts to SSH are hitting a wall.
...
0
votes
1
answer
59
views
aws - ECS capacity provider permission
I'm trying out teraform for managing my infrastructure and got into a bit of an issue and I'm not sure what to look for.
I'm attempting to create a capacity provider for my ECS cluster however I'm ...
0
votes
2
answers
2k
views
terraform apply error alreadyExists on untouched resources
I am starting a new terraform project, following the official guide:
https://learn.hashicorp.com/tutorials/terraform/gke?in=terraform/kubernetes&utm_source=WEBSITE&utm_medium=WEB_IO&...
0
votes
0
answers
33
views
how to use terraform with nsd?
is it possible to manage nsd dns with terraform? i keep getting a NOTINT error but per man page there is an option to accept UPDATE opcodes. when i set drop-updates: no nsd starts fine but i get the ...
0
votes
2
answers
284
views
Terraform: "S3:path_to_terraform.tfstate": x509: cannot validate certificate for <IP> because it doesn't contain any IP SANs
I'm using s3 to save my state. since this is a custom S3 (and not AWS) I configured it as shown below (using IP + Port).
when running terraform init I received this error:
Successfully configured the ...
0
votes
1
answer
221
views
Add Windows VM to domain using Packer
I'm trying to create Windows images for usage on Azure using Packer. As part of this process, I need to put some files, which are located on an existing VM in Azure, in the image. My idea was to add ...
0
votes
0
answers
114
views
Terraform - Dynamic Security Rules not working in Azure
I am unable to see the dynamic rules getting created in Azure Network Security Group (NSG). My template looks ok from validation checks. However, when i run the terraform apply the NSG creates without ...
0
votes
1
answer
30
views
What policies or rights to be provided for a user with which we will run the terraform scripts?
We are creating eks clusters and other resources from terraform.
What are the policies to be given to that user account?
1
vote
1
answer
43
views
How to apply default policies to cloudformation or terraform in aws?
With terraform or cloudformation, we can apply individual permissions while creating a policy.
But how to select default predefined policies like AWSRDSReadyOnlyAccess, like these to the terraform ...
0
votes
0
answers
33
views
Feature Microsoft.ContainerService/AutoUpgradePreview is not enabled in AKS
I am trying to create Azure k8s cluster via terraform using Azure Devops.
terraform apply is failing with below error, i have tired using the below parameter referring
https://registry.terraform.io/...
1
vote
0
answers
466
views
How to map ports in Azure Container Instances via Terraform?
I have two containers in my container group on Azure using Azure Container Instances (ACI), one (container A) exposing ports 80 and 443 to the internet (reverse proxy), the other one (container B) ...
0
votes
0
answers
20
views
Azure Devops Pipeline Trigger based on branch
My yaml pipeline is working fine which perform terraform install, init, validate, plan and apply if the changes are commit to main branch.
Here, i am trying to execute the terraform apply only if the ...
0
votes
0
answers
113
views
Deploying a GCP cloud function: terraform throws error but via gcloud function deploy it works
I'm trying to deploy a cloud function via terraform:
+ resource "google_cloudfunctions_function" "scc-function" {
+ available_memory_mb = 256
+ description ...
0
votes
1
answer
31
views
Importing in terraform
So i want t import an application load balancer under the terraform management, i managed to add some of it's attributes like cross-region and delete protection, global accelerator etc, and i imported,...
0
votes
0
answers
213
views
Unschedulable GKE Pods with gvsior
I created a GKE cluster that makes use of gvisor using Terraform:
resource "google_container_node_pool" "main_preemptible_nodes" {
name = "gke-${var.cluster_name}-preempt-...