4,293 questions
-4
votes
1
answer
52
views
Can we achieve assigning roles and listing for multiple accounts using Native Terraform approach for AWS which is suitable for dyanmic too?
using Management account first i need to list all child accounts and i need to create an IAM role and IAM Trust policy with read only access to all child accounts through terraform and all the read ...
-1
votes
0
answers
111
views
Why does this error occur and how to resolve it
Error message
Error: listing tags for S3 Control Access Point (arn:aws:s3-outposts:ap-southeast-1:xxxxxxx:outpost/xxxxxx/accesspoint/xxxxx): operation error S3 Control: ListTagsForResource, https ...
0
votes
0
answers
36
views
What is the equivalent `TargetCapacitySpecification` spec in a terraform spec?
I'm trying to create a EC2 spot fleet in AWS via terraform script.
From Tutorial: Configure EC2 Fleet to use On-Demand Instances as the primary capacity, I see
{
"LaunchTemplateConfigs": ...
-3
votes
1
answer
72
views
How do I properly define a complex for_each variable
I am trying to define a list of aws_usage_plans, using a for_each.
I am passing in this variable data:
usage_plan_configs = {
"xsmall" = {"name" = "xsmall", "...
0
votes
1
answer
59
views
How to automatically extract AWS Lambda configurations to Terraform for GCP migration? [closed]
I'm migrating multiple AWS Lambda functions to GCP and need to generate Terraform configurations that match the existing AWS setup. Currently, I'm manually writing each Lambda configuration, which is ...
0
votes
1
answer
81
views
Making cloud9 by terraform but can't find the ami
I am making cloud9 by terraform according to the article here
However this code shows the error like this
│ Error: Your query returned no results. Please change your search criteria and try again.
│
│...
1
vote
1
answer
97
views
AWS Elastic Beanstalk.InvalidParameterValue [closed]
I modified my Terraform Repository
several times in order to Deploy an AWS ElasticBeanstalk on my Free Tier AWS Account, but without success.
The API error seen on Terraform is always the same :
"...
0
votes
1
answer
70
views
Terraform lambda runtime management config: Fetch ALL lambda's ARN's
Hi I am working on something very simple
I am creating a lambda runtime management config to manage all my lambda. I have around 9 existing ones.
resource "aws_lambda_runtime_management_config&...
0
votes
0
answers
91
views
How to set permissions for AWS automation documents?
I use AWS automation to stop all my machines. The document for automation is set up with Terraform. I want to restrict the usage of the document to my developer group. But I don't know, how to set the ...
0
votes
1
answer
93
views
Terraform yamldecode Fails When YAML Structure Changes
I have a YAML file structured as follows:
alerts:
la:
la1:
description: "la1"
severity: 1
resource_counter: "004"
enabled: true
ma:
ma1:...
0
votes
0
answers
70
views
Can I update a Terraform write-only attribute based on a dynamic, non-integer value?
I'd hoped to bind a write-only Terraform resource attribute to the value of an AWS SecretsManager secret, using the secret version ID to trigger an update. For example,
something like
data "...
0
votes
1
answer
33
views
Terraform AWS cloudamqp_upgrade_rabbitmq is not working
In order to update CloudAMQP i tried mentioned in https://registry.terraform.io/providers/cloudamqp/cloudamqp/latest/docs/resources/upgrade_rabbitmq
approach - Upgrade to latest possible version, from ...
0
votes
0
answers
65
views
How to get serial console output from AWS ec2 with terraform
How can the EC2 serial console output be logged, to capture the initial setup of EC2?
AWS cli supports get-console-output, but I cannot find any documentation about AWS terraform provider to do so.
-1
votes
1
answer
42
views
How to use Terraform for_each on map(object(list)?
I'm working on adding a IAM policy, but my terraform code fails with the below error because some attributes are determined only after an apply, I don't want to run multiple apply commands, How can I ...
-4
votes
1
answer
162
views
ECS Task definition CPU setting for terraform
I have this error, it shows the error CPU is not correct
Error: creating ECS Task Definition (wb_td): ClientException: Invalid 'cpu' setting for task.
with this source below.
resource "...
1
vote
1
answer
123
views
How can I filter ECS tasks to just those that are running for a FIS experiment?
When putting together a Fault Injection Service experiment in AWS, I want to include all running tasks that are part of an ECS service. Being able to target all tasks in a service is pretty ...
-1
votes
1
answer
373
views
Valkey on AWS via Terraform can not use replication groups
I am trying to set up a cache cluster on AWS via terraform. I want to use the engine 'Valkey'. I am getting the following error when I run terraform plan: The only acceptable Engine type when using ...
0
votes
2
answers
265
views
Terraform in GitHub Actions: 'No valid credential sources found' despite using aws-actions/configure-aws-credentials
While trying to Deploy Infrastructure using Terraform in GitHub Actions, authenticating to AWS via OIDC and the aws-actions/configure-aws-credentials@v4 action.
Despite setting up everything as ...
1
vote
1
answer
163
views
issue with sqs/lambda event filters using terraform
I am running into the following issue using the event source mapping filter with sqs lambda trigger
in terraform the trigger with filter looks like this
resource "aws_lambda_event_source_mapping&...
1
vote
1
answer
181
views
Get files from S3 with lambda
I'm trying to retrieve files from an AWS S3 bucket using a Lambda function, but my script keeps timing out, and I can't figure out why.
"errorMessage": "2025-05-16T14:37:13.093Z fdb6***...
0
votes
0
answers
169
views
How to set the cloud init on the launch template of Terraform AWS EKS module
I am deploying EKS via Terraform AWS EKS module: https://github.com/terraform-aws-modules/terraform-aws-eks and I am using version 20.31.6.
While using the option "use_custom_launch_template = ...
-1
votes
2
answers
459
views
Invalid Provider Configuration with for_each provider OpenTofu 1.9
I have the following opentofu terraform code:
variable "regions" {
type = set(string)
default = ["us-east-1", "us-east-2", "us-west-1", "us-west-2"...
2
votes
1
answer
144
views
How to convert list of objects to just objects in terraform
I have the following code in terrraform
resource "aws_cloudwatch_dashboard" "a_dashboard" {
dashboard_name = "my_dashboard"
dashboard_body = jsonencode({
widgets =...
1
vote
0
answers
59
views
How to add warm pool to aws_elastic_beanstalk_environment using terraform
I am trying to set a warm pool for the autoscaling group, generated by aws_elastic_beanstalk_environment
Can I use the benefits of aws_elastic_beanstalk_environment and pass warm pool configs to it as ...
0
votes
2
answers
160
views
Service Control Policy error with AWS and Terraform
I am getting a strange error from my terraform provider due to an SCP.
The SCP is defined like the following:
{
"Version": "2012-10-17",
"Statement": [
{
&...
-3
votes
1
answer
91
views
How do you allow the Amazon EC2 console to connect to an instance, with terraform
I am creating an AWS EC2 instance with terraform. I want to be able to ssh into the instance from the AWS console's "connect" button. That requires my security group to have an ingress rule. ...
0
votes
0
answers
238
views
Terraform: error "An argument definition must end with a newline"
I am getting this error in terraform when associating subnets with resource access manager
An argument definition must end with a newline.
Code:
resource "aws_ram_resource_association" &...
0
votes
0
answers
48
views
resource "aws_ssm_association" "execute_script" is not triggering the execution of resource "aws_ssm_document" "execute_script"
I have created a ssm document with following terraform code
resource "aws_ssm_document" "execute_script" {
name = "RunOnboardScript"
document_type = "...
0
votes
1
answer
49
views
Run bash script in TF and upload to S3 in Gitlab pipelines
I am using a gitlab pipeline which uses terraform for deploying AWS resources. The pipeline configuration is pre-existing, hence i cannot change anything there. The pipeline run needs to generate some ...
1
vote
1
answer
109
views
"awslogs-multiline-pattern" in terraform ecs module [closed]
I'm trying add an option "awslogs-multiline-pattern" to ecs task definition on ecs module in terraform. And looks like that terraform just dont see this option. Any terraform ecs module ...
0
votes
1
answer
87
views
can't execute terraform due Inconsistent dependency lock file
i'm trying to execute terraform plan, however get the following errors
Error: Inconsistent dependency lock file
The following dependency selections recorded in the lock file are inconsistent with the ...
0
votes
1
answer
81
views
Deployment Not Using Latest SSM Parameter Store Version
I’m using Terraform to manage AWS AppConfig with configuration stored in SSM Parameter Store. When I update the SSM parameter, a new hosted configuration version is created (e.g., current version is ...
0
votes
0
answers
323
views
How to migrate aws_secretsmanager_secret_version resource from secret_string to secret_string_wo?
I've been using terraform and aws_secretsmanager_secret_version resource to assign randomized values into a Secrets Manager secret. Due to the fact that this is documented as insecure (because the ...
0
votes
0
answers
64
views
Incorrect Attribute Type Error in Terraform for AWS Route Table (AWS Route Table and Internet Gateway)
I'm encountering an error while creating a route table in Terraform for AWS. My code looks correct, but I am receiving the following error:
Error: Incorrect attribute value type
on main.tf.json line ...
0
votes
1
answer
193
views
Step function not deployable through terraform
I am trying to deploy AWS Step Function using Terraform but the deployment is failing with the below error
Failed to execute "terraform init"
fork/exec /usr/local/bin/terraform: argument ...
0
votes
0
answers
136
views
AWS API Gateway Returning {"message":"not found"}
Been working on this semi-secure (will add HTTPS later) API Gateway. I've managed to deploy the TF into the cloud, and it built fine.
My main issue currently is that when I try to use the Invoke URL (...
0
votes
2
answers
210
views
Why changing root block device type is in-place update not replace?
Expected Terraform aws_instance root_block_device volume_type change will cause replace (destroy and create) of the instance because I believed the underlying SSD device type will cause replacement.
...
0
votes
0
answers
53
views
How to use iam_policy with condition as optional?
I want to use the terraform resource aws_iam_policy with the policy key set to a complete policy configured in a var and use jsonencode on the value of the var.
I have no issues doing this as long as ...
0
votes
1
answer
128
views
Merging multiple aws iam roles for lambdas in terraform
I have following configuration in terraform:
locals {
common_env_vars = {
DATABASE_NAME = var.database_name
}
lambda_config = {
filename = "empty.zip"
...
0
votes
0
answers
298
views
terraform - cross account sns sqs subscription fails on pending confirmation
Im trying to subscribe my sqs queue from account A to sns topic in account B but my sqs to sns subscription is failing on terraform apply after 2 minutes because its not able to auto confirm the ...
0
votes
1
answer
158
views
EventBridge Event bus doesn't receive cross-account events
I'm trying to send EventBridge events to the Event bus of our backup account, but the bus isn't receiving the events. I've been following this blog post, and translated the example given into ...
0
votes
0
answers
36
views
The output of CloudFront in Terraform doesn't behave like other resources
I'm using Terraform for my deployment in AWS.
It's mostly working, but when I try to create a policy between a bucket and a cloudfront I'm getting the error:
module.cloudfront_test is a object This ...
-2
votes
2
answers
73
views
Constant tag values in Terraform
We would like to use a tag to identify the team who has authored the HCL code we are using to deploy AWS resources.
We wish to use this tag value so we can have Wiz provide a snapshot of the resources ...
0
votes
1
answer
103
views
Terraform dynamic block to be executed with default values
This is my existing terraform module code for AWS Batch resources:
resource "aws_batch_compute_environment" "compute_environment" {
count = var.create_compute_environment ? 1 : 0
...
0
votes
1
answer
106
views
Terraform dynamic blocks, in this case for aws_db_proxy, generate perpetual diff
I am not sure if this issue is due to Terraform, or due to the specific provider/resource I am using. But for specificity, the problem I have is for an aws_db_proxy resource with multiple auth blocks ...
-1
votes
1
answer
108
views
aws_glue_catalog_database is having checkbox checked for `Default permissions for newly created tables` by default when created through terraform
I have a terraform resource defined for aws_glue_catalog_database, but by default it is checking the checkbox under Default permission for newly created tables. I have tried keeping the ...
0
votes
1
answer
31
views
Cannot output terraform as key value [closed]
variable "managed_addons" {
description = "EKS manged addons"
type = map(string)
}
resource "aws_eks_addon" "this" {
for_each = var....
0
votes
1
answer
109
views
How To Access Sub Keys In Nested Maps
Currently learning terraform and I am trying to create 2 VPCs (dev and stg) below. I would like to populate cidr_block and availability_zone in subnets.tf by accessing ap-southeast-1* and ...
0
votes
0
answers
80
views
Is there a way to stop Terraform from starting an instance when it's created/modified?
Currently, I have several AWS EC2 instances that are set up to run some heavy processing workloads on startup (there are several mechanisms to start them at the appropriate times). However, when any ...
-1
votes
1
answer
246
views
What would be the correct way to create aws cloudwatch alarms with multiple metrics and multiple math expressions using terraform?
I am trying to create a cloudwatch alarm for Throughput utilization (%) for an AWS EFS using terraform. When using console to do the same, I found that Throughput utilization (%) is a combination of ...