All Questions

Filter by
Sorted by
Tagged with
31 votes
2 answers
29k views

Is it possible to execute a CloudFormation file in Terraform?

One team has already written a cloudformation template as a .yml file that provisions a stack of resources. Is it possible to leverage this file by executing it from within Terraform? Or does it have ...
user1521567's user avatar
  • 1,803
29 votes
7 answers
25k views

Create AWS Athena view programmatically

Can you create views in Amazon Athena? outlines how to create a view using the User Interface. I'd like to create an AWS Athena View programatically, ideally using Terraform (which calls ...
Algamest's user avatar
  • 1,479
23 votes
2 answers
8k views

What is the difference between AWS ElastiCache Cluster and AWS ElastiCache Replication Group?

On terraform/cloudformation documentation there are two different resources to create an ElastiCache Redis instance: aws_elasticache_cluster (https://www.terraform.io/docs/providers/aws/r/...
darkcode's user avatar
  • 908
19 votes
2 answers
7k views

Auto-Scaling Groups Don't Update on Launch Configuration Change

I have an AWS Auto-Scaling Group, a Launch Configuration, and an Auto-Scaling Group Policy defined in Terraform like this: resource "aws_autoscaling_group" "default" { name = "..." ...
Naftuli Kay's user avatar
  • 89.6k
14 votes
4 answers
4k views

Deploying lambdas effectively (only deploy those that changed) with Terraform/CloudFormation/Something else

So far, I have been using CloudFormation to deploy my lambdas. I find this process very slow and inefficient tho - eg. it may take minutes but it should have taken just seconds if its just deploying ...
Jiew Meng's user avatar
  • 85.9k
13 votes
3 answers
20k views

Convert Terraform Templates to Cloudformation Templates

I want to convert the existing terraform templates(hcl) to aws cloudformation templates(json/yaml). I basically want to find security issues with these templates through CFN_NAG. An approach that ...
H4X's user avatar
  • 197
11 votes
3 answers
23k views

Terraform - Specifying multiple possible values for Variables

CloudFormation provides AllowedValues for Parameters which tells that the possible value of the parameter can be from this list. How can I achieve this with Terraform variables? The variable type of ...
seou1's user avatar
  • 466
10 votes
3 answers
10k views

Create CloudFormation stack without resources

I am using Terraform for most of my infrastructure, but at the same time I'm using the serverless framework to define some Lambda functions. Serverless uses CloudFormation under the hood where I need ...
TheEdgeOfRage's user avatar
10 votes
3 answers
1k views

Serverless Framework: ways to achieve full "infrastructure as code"?

I've followed an excellent guide (Serverless Stack) that creates a typical CRUD serverless infrastructure with a react frontend. It's using the Serverless Framework for AWS. What I don't like is that ...
Tom's user avatar
  • 8,010
10 votes
3 answers
3k views

Should the infrastructure code be stored in the same repository as the application code?

I am setting up an infrastructure to support a WebApp. One of my repositories have all the Network Infrastructure (VPC, Subnets, NAT, Bastion and so on). The WebApp has a Route 53 + ALB + AutoScalling ...
p.magalhaes's user avatar
  • 7,936
8 votes
2 answers
6k views

CloudWatch Alarm Percentage of errors API Gateway

I'm trying to setup and alarm in Cloudwatch using terraform. My alarm basically needs to check if there is more than 5% of 5xx errors in the gateway during 2 periods of 1 minute. I've tried the ...
Jaime S's user avatar
  • 1,578
6 votes
1 answer
6k views

how can I attach multiple pre-existing AWS managed roles to a policy?

I want to associate existing policies in AWS to a role, I am using the terraform tool I want to associate these policies, this code is with the aws cloudformation tool: AWSCodeCommitFullAccess ...
Daniel Contreras's user avatar
5 votes
1 answer
3k views

Exporting AWS Data Pipeline as CloudFormation template to use it in Terraform

I'm trying to export existing AWS Data Pipeline task to Terraform infrastructure somehow. Accordingly, to this issue, there is no direct support for Data Pipelines, but it still seems achievable ...
sorjef's user avatar
  • 554
4 votes
1 answer
2k views

Can aws cdk provide remote state?

Terraform has a remote stack via well documented plugins, i.e. terraform.backend.s3 https://www.terraform.io/docs/language/settings/backends/s3.html Can aws cdk provide remote state for the stacks? I ...
Irina's user avatar
  • 1,099
4 votes
1 answer
18k views

How To Convert CloudFormation template to terraform code

I have Cloudformation template something like this Resources: WafValidHostsCondition: Type: AWS::WAF::ByteMatchSet Properties: Name: !Sub ${AccountCode}-${RegionCode}-${Application}-...
Mkrtich Matevosyan's user avatar
4 votes
1 answer
3k views

Role Switching ( assume role ) with AWS and Terraform

Background: We've started a spike investigation into generating infrastructure using Terraform rather than directly with Cloudformation. We have multiple AWS accounts which are separated for Live, ...
it-support-pug's user avatar
4 votes
1 answer
2k views

Terraform import aws_cloudwatch_log_stream

I need to import an existing aws_cloudwatch_log_stream (or AWS::Logs::LogStream in CloudFormation) into my configuration. However, it appears that Terraform does not support this functionality. ...
Godot-Dev's user avatar
4 votes
1 answer
2k views

Problem passing parameters created in Terraform to CloudFormation

With guidance from a previous SO post, I am trying to pass two parameters created in my Terraform template into a CloudFormation template as parameters: My Terraform (0.13.5) code: resource "...
BPS's user avatar
  • 617
3 votes
3 answers
4k views

Programmatically create and deploy On-Demand EC2

Is it possible to programmatically get/deploy and start an EC2 instance? Essentially pick your instance type, AMI and start it up? I see the StartInstance method but this only applies to instances ...
Jake Wilson's user avatar
  • 89.9k
3 votes
2 answers
1k views

Cloudformation/Serverless vs Terraform in AWS

I would like to understand the need of tools like Terraform. When we do have Cloudformation template available and one can create/update all AWS services with that , What is the point in using a ...
Sajal Saxena's user avatar
3 votes
1 answer
28k views

Terraform - list of string required (cidr_blocks in AWS)

In Terraform I'm having problems inputting a list that will be stored in a variable. While executing terraform plan, I get asked for a cidr_blocks (which should be a list of strings). I tried to type ...
JonyD's user avatar
  • 1,287
3 votes
1 answer
6k views

Can i update an existing ec2 instance with terraform

Is it possible to edit an existing resource example: an ec2 instance with the terraform template. Ex: I have a ec2 instance created with aws console, can i add that ec2 instance to add a new security ...
pmfl's user avatar
  • 2,069
3 votes
1 answer
2k views

create log group and log stream using serverless framework

I have the following Terraform code. How can I implement the same in Serverless framework? resource "aws_cloudwatch_log_group" "abc" { name = logGroupName tags = tags } ...
user2281858's user avatar
  • 2,007
3 votes
1 answer
14k views

IAM policy: MalformedPolicyDocument: Syntax errors in policy

I was able to successfully run a cloudformation stack that included the following snippet, and now my ultimate goal is to get this ported to Terraform, but.. I'm getting a malformed syntax error ...
buildmaestro's user avatar
  • 1,436
3 votes
0 answers
247 views

Migrating CloudFormation to Terraform aws_lb_target_group_attachment cannot be imported [closed]

If we are moving from cloudformation to terraform over a running aws resource, how do we import the alb target attachment to the statefile? terraform does not support it so we have to recreate it? Can ...
awsgeek's user avatar
  • 51
2 votes
2 answers
3k views

Moving resources between CloudFormation stacks

Lets imagine that i have a cloudformation stack with 2 EC2 instances 1 S3 bucket and 1 dynamoDb table. Everything is good with this stack until we decide to do some refactoring and split this stack ...
user3341697's user avatar
2 votes
2 answers
5k views

Terraform resolving Cloudformation Outputs

I have a terraform deployment which it deploys the SNS topic from a CloudFormation stack. I export the ARN of the SNS topic but i am struggling to consume the output in TF "Outputs" : {...
Nick Barton-Wells's user avatar
2 votes
4 answers
3k views

How to convert existing AWS environment into infra as code?

When we were building our AWS account, we did not think about using cloud formation or terraform. Now we have our environmemt all setup but don't want to tear down everything and build using cloud ...
Karthik's user avatar
  • 339
2 votes
1 answer
10k views

Terraform - Invalid template interpolation value

I'm trying to use terraform to create an AnomalySubscription with AWS Cloudformation. Based on: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ce-anomalysubscription.html ...
HeadinCloud's user avatar
2 votes
1 answer
2k views

How to export an existing CodePipeline to CloudFormation template

This is more of a lack of understanding on my part but I cannot seem to debug this. I have created an codepipeline which runs terraform apply ( which internally creates the aws infrastructure for me )....
adit modi's user avatar
2 votes
1 answer
3k views

Error when creating S3 bucket notification in Terraform

I'm having an issue when creating a bucket notification to trigger a Lambda function. The error: Error putting S3 notification configuration: InvalidArgument: Unable to validate the following ...
madej's user avatar
  • 49
2 votes
1 answer
1k views

How to create a template from existing resources?

I've heard about "CloudFormer" tool, to automatically generate a base template from existing resources on the cloud. https://medium.com/@ridmag/how-to-use-aws-cloudformer-e8d848cfafe1 I can'...
pinale's user avatar
  • 2,164
2 votes
1 answer
2k views

Can we match multiple conditions in Terraform before creating a resource?

I am trying to convert an AWS CloudFormation script to Terraform but the problem I am facing here is Cloudformation has something called conditions were we can specify multiple conditions to match ...
Rai's user avatar
  • 177
2 votes
1 answer
3k views

Read bucket object in CDK

In terraform to read an object from s3 bucket at the time of deployment I can use data source data aws_s3_bucket_object { } Is there a similar concept in CDK? I've seen various methods of uploading ...
Yuriy Galanter's user avatar
2 votes
1 answer
302 views

CDK/Cloudformation shared state

Pretty new to CDK/Cloudformation, just moving from Terraform, and was wondering if CDK/Cloudformation have something similar to Terraform's remote state? Or some other way that different team members ...
Yuriy Galanter's user avatar
2 votes
1 answer
4k views

Error creating application autoscaling target on AWS when using Terraform - Defining `scalable_resource` for custom `aws_appautoscaling_target`

Goal I'm implementing an auto-scaling solution for Kinesis data streams. One possible solution, which I am following, is well documented in the aws-samples/aws-application-auto-scaling-kinesis repo....
bPratik's user avatar
  • 6,969
2 votes
1 answer
767 views

Tool to track SQL schema like infrastructure as code?

I have been using AWS Cloudformation and Terraform to manage cloud infrastructure as code (IAC). The benefits are obvious. 1) Template file to concisely describe your infrastructure 2) Versioning 3) ...
Jon Vogel's user avatar
  • 5,476
2 votes
2 answers
898 views

Enable and configure AWS Cognito Advanced Security Features via Terraform or Cloudformation

How do you enable the AWS Cognito Advanced Security Features option via Terraform or Cloudformation and then configure the Compromised Credentials option? There doesn't appear to be anything listed ...
Gary MacPherson's user avatar
2 votes
1 answer
645 views

What are valid reasons to choose Terraform instead of AWS CloudFormation if all the architecture components are aws-specific products?

In an architecture where you have all of your components using aws-specific products, like web servers in EC2 instances, your CDN using CloudFront, microservices in ECS, why would someone choose to ...
Ivonne Aldana's user avatar
2 votes
2 answers
2k views

AWS CloudFormation provisioning... UserData vs. Ansible or the likes? [closed]

What is the difference between provisioning using AWS CloudFormation UserData vs. Ansible? I know that in relation to Puppet for example, it enforces provisioning rules even when a change is done (...
Itai Ganot's user avatar
  • 6,135
2 votes
0 answers
119 views

Cloudformation features unavailable in Terraform

Does anyone know of any AWS Cloudformation features that are currently unsupported by Terraform? I'm aware of the case of rolling deployments of new instances into an auto-scaling group Not sure if ...
Hammed's user avatar
  • 1,497
2 votes
1 answer
2k views

No export named vpc-xxxxxx-vpc-id found. Rollback requested by user

I am quite new to AWS and I am trying to launch a security group from and cloud formation: I have this in my parameters NetworkStackName: Description: "Network Stack Name which created ...
Theonestar's user avatar
2 votes
0 answers
2k views

Terraform - DynamoDB Table Update without Destroying it

I already have a resource created (DynamoDB table) using this resource "aws_dynamodb_table" "my_dynamo_table" { name = "my_table" hash_key = "Id" } Now, I would like ...
Muthaiah PL's user avatar
  • 1,128
1 vote
1 answer
147 views

How can I write a YAML Join Format of AWS Cloudformation to Terraform format?

I'm trying to convert an AWS Cloudformation Managed Policy document into a Terraform file to create policies. However, I'm having trouble with the Join format under the Resource section which it seems ...
Gilroy's user avatar
  • 306
1 vote
2 answers
735 views

Terraform equiv to Custom::LoadLambda in CloudFormation

I know the equivalent to AWS::Lambda::Function is aws_lambda_function But I'm not sure what the equiv for Custom::LoadLambda I'm trying to translate the below into Terraform: CreateRsaKey: Type:...
Simply  Seth's user avatar
  • 3,370
1 vote
2 answers
730 views

How to pass a list of AZs from Terraform to a CloudFormation template?

I have a CloudFormation template that defines this parameter: "AvailabilityZones" : { "Description" : "List of Availability Zones used ... ", ...
Nathan Sowatskey's user avatar
1 vote
2 answers
1k views

Why CloudFormation replace resource during adding resource tags?

As described in the documentation, I think CloudFormation will update with no interruption just by changing to add a tag. In my case, another team uses terraform to add tag resources with generic tags,...
wizun's user avatar
  • 13
1 vote
1 answer
599 views

Terraform: cat command issues

I have Terraform 0.13.5 installed on RHEL 8.3 AWS EC2 instance. I have a single file in my directory "main.tf" whose contents are as follows: variable "myvar" { type = ...
Vishwas M.R's user avatar
  • 1,539
1 vote
1 answer
608 views

Terraform: Write a CloudFormation Template to disk

We are using Terraform along with a vendor supplied CloudFormation template. It is all working except for when there are changes to the template. Terraform does not show you what will change as it's ...
RickBowden's user avatar
1 vote
2 answers
1k views

How to output node's ip from each AZ in Terraform

I am using terraform definitions to launch 10 nodes on AWS in Tokyo region (Two AZ's). So its like 5 nodes are being launched in each AZ. resource "aws_instance" "test" { count = "...
Nahush's user avatar
  • 421