All Questions
Tagged with aws-cloudformation terraform
117
questions
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 ...
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 ...
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/...
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 = "..."
...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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
...
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 ...
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 ...
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}-...
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, ...
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. ...
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 "...
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 ...
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 ...
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 ...
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 ...
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
}
...
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 ...
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 ...
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 ...
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" : {...
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 ...
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
...
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 )....
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 ...
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'...
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 ...
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 ...
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 ...
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....
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) ...
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 ...
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 ...
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 (...
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 ...
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 ...
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 ...
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 ...
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:...
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 ... ",
...
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,...
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 = ...
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 ...
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 = "...