Questions tagged [terraform]

For questions about Terraform, an open source tool to maintain infrastructure.

Filter by
Sorted by
Tagged with
0 votes
1 answer
8 views

Resizing a volume in terraform without enable_online_resize?

Is there a way to terraform apply and recreate the storage volume rather than setting enable_online_resize or running a terraform destroy first? openstack_blockstorage_volume_v3.repo: Modifying... [id=...
user avatar
0 votes
0 answers
12 views

Helm is not creating the consul server during release causing the client to fail

I'm deploying Consul using Terraform and the Helm provider. resource "helm_release" "helm-consul" { name = "consul" repository = "https://helm.releases....
user avatar
0 votes
0 answers
19 views

How to get Kubernetes manifest from the terraform kubernetes provider?

We have all our Kubernetes applications defined in Terraform using the terraform-kubernetes-provider. We're trying to move to a GitOps approach (using ArgoCD) but can't find a way to get Terraform to ...
user avatar
  • 101
0 votes
1 answer
24 views

Terraform - retrieving arn from another module

I'm trying to get the arn of the kms key for use in the S3 bucket kms_master_key_id, the code below is how I thought it might work. I can output the arn value to the root but am unsure how to access ...
user avatar
  • 1
0 votes
1 answer
22 views

Terraform plan does not update AWS Task Definition with last active revision value

I would like your help on a situation that I'm facing with terrafom. My company recently launched a new website whose wordpress is hosted in an AWS ECS container. I had to make some adjustments to the ...
user avatar
0 votes
1 answer
22 views

Unable to connect from my local system to ec2 instance created by terraform script

Following is the source code: variable "ec2_instance_type_name" { type = string default = "t2.nano" } terraform { required_providers { aws = { ...
user avatar
0 votes
0 answers
11 views

How to configure CircleCI IaC Terraform pipeline to provision AWS Services on multiple environments?

I have created a CircleCI pipeline to provision an S3 bucket on AWS. I would like to configure this pipeline to provision S3 on multiple environments like DEV, SIT, UAT etc. I am not sure how to ...
user avatar
  • 225
0 votes
1 answer
69 views

Unable to authenticate with Terraform AWS provider

I am trying to use terraform to spin up a new instance of a server. Using the AWS provider , I get this error: ╷ │ Warning: Resource targeting is in effect │ │ You are creating a plan with the -...
user avatar
0 votes
1 answer
44 views

Cloud-config in Terraform does not work, nothing seems to happen and it fails silently

I'm currently provisioning a machine with Cloud Config in user_data (I've also tried user_data_base64). When I run my command in Terraform I have, resource "aws_instance" "web" { ...
user avatar
0 votes
1 answer
26 views

Does Terraform provide a mechanism to find the provider version?

Other than reading .terraform.lock.hcl is there a mechanisms in Terraform to find the version of the providers I am using with the cli interface? I don't see the version when I run terraform providers ...
user avatar
0 votes
1 answer
78 views

How do I upgrade or pin a Terraform Provider?

This is a follow-up to The provider hashicorp/aws does not support resource type "aws_internet_gateway_attachment". The crux of it is, I'm using 3.75.1 of the AWS provider, and I need to ...
user avatar
0 votes
1 answer
189 views

The provider hashicorp/aws does not support resource type "aws_internet_gateway_attachment"

Why do I get this error with Terraform, The provider hashicorp/aws does not support resource type "aws_internet_gateway_attachment". You can see the resource ...
user avatar
0 votes
1 answer
54 views

Terraform: Why is null_resource's remote-exec not connecting to aws_instance via SSH?

I've been going through answers to similar questions on this StackExchange and on StackOverflow and reading through documentations all day ... Here's the .tf file I'm executing: # defines the AWS ...
user avatar
1 vote
1 answer
28 views

How to assign an ACL for each S3 Bucket in a tuple/list using Terraform?

I have a terraform file set to create a list of S3 buckets, and I was assigning acl to each bucket the old way: resource "aws_s3_bucket" "this" { count = length(var....
user avatar
0 votes
1 answer
85 views

validating map of objects

I am trying to validate a map of objects that is typed as below : variable "ecs_config_map" { type = map(object({ cpu = number memory = number desired = number ...
user avatar
  • 3
0 votes
0 answers
20 views

TerraForm separate stages

I want to separate my development stages in the TerraForm repository. The TerraForm workspaces page states: "Workspaces alone are not a suitable tool for system decomposition, because each ...
user avatar
  • 1
2 votes
0 answers
63 views

"ipv6_cidr_block": all of `ipv6_cidr_block,ipv6_ipam_pool_id` must be specified

Usage: import Version: Terraform v1.1.9 provider registry.terraform.io/hashicorp/aws v4.11.0 I've something like this defined: assign_generated_ipv6_cidr_block = "true" cidr_block ...
user avatar
1 vote
0 answers
37 views

Trying to access a value from a jsonencoded attribute in a terraform manifest file

I have the following aws_ecs_task_definition resource definitions in a child module: resource "aws_ecs_task_definition" "main" { family = "${var.name}-task-...
user avatar
0 votes
0 answers
90 views

A managed resource "aws_apigatewayv2" "lambda-api" has not been declared in the root module

I know I need to declare this somewhere, the root module, where can I find this module and the relevant documentation on how to implement this properly? This is from a tutorial I am trying to follow: ...
user avatar
  • 1
3 votes
2 answers
36 views

Cloud-Init Script Won't Run?

I am working through this Terraform tutorial, which boots up a Go web app on an EC2 instance, using Terraform and cloud-init. This is my Terraform config file: terraform { required_version = "&...
user avatar
  • 31
0 votes
1 answer
101 views

terraform apply - how to use wildcard or range for indexes?

I have 10 virtual machines to be re-created. I want to do it in 2 groups, first 5 machines [0-4] and second 5 machines [5-9] terraform apply -replace=module.ci.azurerm_windows_virtual_machine.vm[0-4] ...
user avatar
1 vote
0 answers
16 views

how to manage IaC for single tenant self service clients?

We are building a saas for single-tenant self-service clients (clients can register themselves). Every client has its own resources (for example, AWS buckets, CloudFront distro, DNS records, EKS ...
user avatar
  • 11
1 vote
1 answer
39 views

Terraform Aws S3 - deny all users except for a specific user

I have a bucket which I need to restrict to a specific user, I have written the following script but it still seems to allow all users to operate on the bucket. resource "aws_s3_bucket" &...
user avatar
  • 111
1 vote
1 answer
25 views

Create AWS SG and use it

I am trying to create a security group (SG) using Terraform and then use it for an AWS instance. My config looks like resource "aws_security_group" "my_sq" { vpc_id = aws_vpc....
user avatar
  • 113
0 votes
1 answer
87 views

How do you a initialize a new volume without a file system or partition table?

I'm using OpenStack and I am trying to provision a compute resource on it. I want that compute resource to attach to a volume. We have three things in play. Volume openstack_blockstorage_volume_v3 ...
user avatar
0 votes
0 answers
85 views

Block Device Mapping is Invalid: Boot sequence for the instance and image/block device mapping combination is not valid

I'm getting the following 400 error from my API endpoint, Block Device Mapping is Invalid: Boot sequence for the instance and image/block device mapping combination is not valid. When I add, ...
user avatar
0 votes
1 answer
25 views

Does cloud-init store the copy of the init it ran first?

I'm sending my cloud-init file to Terraform via user_data. Is this stored anywhere on the machine that runs it? I know it may get merged with other stuff before it's run.
user avatar
0 votes
2 answers
75 views

Is there a way to install a private key for a user with cloud-init?

I have a user that needs to authenticate against a company source repository when using git clone. To set this up for the user I need to specify a users private key (not the host private key in /etc). ...
user avatar
1 vote
1 answer
296 views

Using a terraform template to produce a cloud-init yaml: template variables do not respect yaml context/whitespace

I am using Terraform. Terraform has a notion templatefile which can be used to take variables that Terraform has access to (locally supplied or retrieved externally) and to apply them to a Jinja2 ...
user avatar
1 vote
0 answers
28 views

On consecutive runs `terraform apply` tries to update the hostname after it was set properly

I'm setting my hostname using a cloud-init file which has this, hostname: "${hostname}" fqdn: "${fqdn}" This sets the hostname and fqdn to the results of the DHCP setting on a ...
user avatar
0 votes
1 answer
26 views

Terraform wanting to redeploy azure vms for 'no' reason

I got a VM defined in terraform like this: resource "azurerm_linux_virtual_machine" "vm" { name = var.vm-name resource_group_name = var....
user avatar
  • 1
0 votes
1 answer
79 views

How does a new network and subnet have FQDNs without DNS Nameservers?

This is an extension and a simplification of my prior problem. I have created a Network Subnet A port attached to the above network and subnet A compute instance on that port. With the following ...
user avatar
0 votes
1 answer
39 views

Error: Error creating openstack_compute_floatingip_associate_v2

When I try to create a openstack_compute_floatingip_associate_v2 in terraform I'm getting the following error, Error: Error creating openstack_compute_floatingip_associate_v2: Bad request with: [POST ...
user avatar
0 votes
1 answer
37 views

Terraform errors openstack_compute_floatingip_v2: Resource not found

When I run terraform I get, openstack_compute_floatingip_v2.sandbox: Creating... ╷ │ Error: Error creating openstack_compute_floatingip_v2: Resource not found │ │ with ...
user avatar
0 votes
0 answers
186 views

How do I force Terraform, Service Principals, and Service Connections to automatically scope to my Subscription Ownership only given MS Graph API?

AAD Graph API has now been fully deprecated. Terraform, Service Principals, and Service Connections now use the MS Graph API. My company has given me my own Visual Studio Subscription and I have my ...
user avatar
0 votes
1 answer
513 views

Terraform get subnet id by it's CIDR block

I have a list of CIDRs for my subnets and want to get their ids. Is it possible to do with terraform? my_subnets = ["212.12.1.0/24", "212.12.2.0/24", "212.12.3.0/24"] I ...
user avatar
0 votes
0 answers
179 views

How to provide Docker hub credentials and pull images from private repository in Docker hub using terraform?

Do I need docker image registry as I have seen in this link : How can I use Docker Hub in Terraform? my code looks like in main.tf and also terraform version 1.1.4 on windows terraform { ...
user avatar
1 vote
1 answer
122 views

Is it possible to store your state for different Terraform Workspaces separately?

Let's say I have a terraform project with a production and development workspace. Is it possible to store the development workspace elsewhere so I don't have to give the admin the ability to run ...
user avatar
0 votes
2 answers
341 views

Terraform workspaces vs isolated directories?

I'm reading the "Terraform: Up & Running, 2nd Edition" book by Yevgeniy Brikman, the author is going through a lot of work to NOT use workspaces? Is this sound? It seems like really ...
user avatar
1 vote
1 answer
36 views

Terraform single-file modules

I've been reading up the Terraform standard module structure and I see they want a main, outputs, and variables file in every one. I have a pair of modules where everything fits in a single tmux ...
user avatar
  • 13
0 votes
0 answers
57 views

how to prevent aws ecs service scaleOut policy from performing a scaleIn operation?

Intro: I am having an issue with autoscaling on my ECS service, the ScaleUp policy is sometimes scaling down my tasks. this is not expected or desired. The problem: I have autoscaling StapScaling with ...
user avatar
1 vote
0 answers
70 views

Creating Multi-Origin endpoint groups in Azure using Terraform

I am attempting to provision multiple origins, which are storage accounts (blobs) in different regions. Whilst provisioning the CDN profiles (multiple environments) and a single origin for each is ...
user avatar
  • 11
0 votes
1 answer
329 views

SubnetsHaveNoServiceEndpointsConfigured error when deplying cosmosdb account

I'm trying to deploy cosmosdb account with mongodb on azure with terraform. But 'terraform apply' times out with SubnetsHaveNoServiceEndpointsConfigured error. Error: creating CosmosDB Account "...
user avatar
0 votes
0 answers
177 views

Terrafrom | count is set and used inside resource but still gives Reference to "count" in non-counted context error

first I set my data (here is service principle) to access the resources, the idea is do not create any if it is not a production environment by count = var.env == "prod" ? 1 : 0 data "...
user avatar
  • 101
0 votes
1 answer
511 views

AWS ECS Green/Blue with CodePipeline: The ELB could not be updated due to the following error: Primary taskset target group must be behind listener

I've been trying for hours to get a basic CodePipeline up and running with ECS Green/Blue. We're creating a prototype, so everything is in a single repo for now, and the Dockerfile, taskdef.json, ...
user avatar
  • 119
0 votes
0 answers
33 views

assign different network_security_groups to different VM

I have a terraform config with multiple virtual machines in its vnet. The machines are on the same vnet + subnet and that subnet has a network_security_group attached, like so: resource "...
user avatar
0 votes
1 answer
288 views

network_security_group_id not expected in azurerm_network_interface

I'm following a lecture on terraform for azure. They add a property network_security_group_id to an azurerm_network_interface resource "azurerm_network_interface" "demo-instance" { ...
user avatar
0 votes
1 answer
665 views

Terraform: add to existing AWS policy, or create policy if needed

Several of our terraform root modules need add to an existing policy that provides read-only permissions for S3 buckets -- each module has its own bucket. I cannot figure out how to add to the ...
user avatar
0 votes
0 answers
63 views

Terraform dynamic configuration for AWS EMR task fleet: How to include Spot or On-Demand capacity and launch specifications?

I am trying to create a Terraform configuration that would allow me to launch an EMR cluster with a Task Fleet running on either On-Demand or Spot instances, according to user's choice made when ...
user avatar
0 votes
1 answer
53 views

[Multiple projects, one Azure subscription], Terraform - feasibility of distributed configuration

I know terraform a bit, but in the past I worked just with one terraform repository serving all infrastructure (with modules per provider/function). infrastructure |- modules | |- gcp | ...
user avatar

1
2 3 4 5