I am using terraform and terragrunt for my companies aws infrastructure, general structure is like this, i have two main folder, one for modules, other one for environments and sourcing modules to environment folder using terragrunt, one module is for general vpc infrastructure, i have separate module for vpc-peering, i created separated folders for vpc and vpc-peering in environment folder, so both of them has different terraform state on s3, the problem is that vpc-peering is creating route-tables also and when i want to apply some changes on vpc module it deletes records created from vpc-peering module, is there any way to inject route tables into vpc module? I know that i can move vpc-peering module into vpc and have one both module but it takes quite some time to rewrite all the stuff and i would love to know any other way.
Terraform state conflict between vpc and vpc-peering modules
471 Views Asked by Lado Golijashvili At
2
There are 2 best solutions below
0
shashi
On
I am not sure if you are using git as source code for the terraform, if yes then you can keep the modules in the separate git repository and call the module for route table as you want.
eg. :
resouces "aws_route" "public_igw_route" {
source = "[email protected]:user/infra-modules.git//aws-route"
}
Related Questions in AMAZON-WEB-SERVICES
- "Access Denied" - User's Permissions to S3 Bucket
- Cohort analysis with Amazon Redshift / PostgreSQL
- Using Amazon KMS service on Heroku
- can't ssh in after cloning an EC2 instance on Amazon AWS
- Using HDFS with Apache Spark on Amazon EC2
- How can I access Mule ESB Community edition via browser?
- AWS EC2: Migrating from Windows to Linux Server
- AWS ELB Load Balancer: is it possible to set multiple session cookies?
- AWS Flow Framework: Can we run activity worker and activity task on different EC2 instances
- Unable to access files from public s3 bucket with boto
- Cloudfront stream only part of the video
- s3cmd not working as cron-task when echos/dates are added
- How to deploy django 1.8 on Elastic Beanstalk using Docker
- InstanceProfile is required for creating cluster - create python function to install module
- How to fix WordPress HTTPS issues when behind an Amazon Load Balancer?
Related Questions in TERRAFORM
- Terraform: associate an aws_iam_role with an aws_iam_policy
- How to change the subnet association from one route table to another route table using terraform?
- How to avoid the destroy action in terraform apply?
- Is there a way to create EMR security config with CloudFormation/Terraform
- Referring to variables in another terraform file you can't modify
- EC2 instances launched via Terraform do not pass the status checks or have insufficient data
- Recreate Same Security Group Rule Each time I execute "terrafrom apply/plan"
- Trouble setting terraform variable from CLI
- Terraform -var-file not working for file present in the same directory
- How to get the most recent ebs snapshot using terraform datasource?
- protocol Tcp with floatingIP disabled, must not be used with the same backend IP
- Shell script producing the escaping character (\) with escaped double qoutes
- vpc_zone_identifier should be a list
- Building a custom terraform provider errors out
- Create AWS RDS instance in non default VPC using terraform
Related Questions in TERRAGRUNT
- Take ECS Task Definition environment variables from Terraform input variables
- Losing sync with state in TFC (local execution) when clearing terragrunt cache
- How to indicate custom configuration files for terragrunt modules?
- Terragrunt - How use outputs values in the same module
- Terragrunt defining a value in .hcl that is to be used by another file
- Terragrunt state file keeps overriding
- Terragrunt/-form clone in Gitlab pipeline when using git::ssh://git@ for module source
- Terrragrunt working example of passing providers to modules
- Terragrunt cannot get provider from generated provider.tf from parent terragrunt.hcl
- Terragrunt and tflint warnings "Variable declared but not used"
- How to audit terragrunt tree for modules and download them?
- Atlantis Error when using with terragrunt
- Dynamic S3 Bucket Path in Terragrunt Using Command Line Variable
- Terragrunt guidance on using public Terraform registry modules
- Terragrunt for_each value, can't retrieve data in other resources
Related Questions in AWS-VPC-PEERING
- Connect anypoint platform to aws
- A Node with only private IP in a vpc can not connect to other node in other vpc
- VPC Peering - DNS resolves to public IP
- Lambda -> Atlas connection timeout (private subnet - peering)
- Troubleshooting Lambda to RDS connection with VPC peering
- How To Solve 504 Bad Gateway Timeout Error From Aws Api Gateway?
- Connection from Lambda to RDS in a different account
- Share RDS instance with another VPC, but no other resources?
- Terraform state conflict between vpc and vpc-peering modules
- AWS - Different Region Lambda VPC to Fargate
- AWS Cross-Region VPC Peering Cloudformation doesn't recognise the VPC in the other region
- What is the difference between VPC Peering and VPC Endpoint Service? And when to use them?
- is there a way to peer/connect lightsail vpc with aws vpc on same region?
- AWS: connect to VPC endpoint in Accepter VPC from fargate task in Requester VPC
- Unable to configure cross-account communication between AWS Lambda and AWS Kafka (MSK cluster)
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
They shouldn't both be creating route tables. The VPC module should be creating route tables, and the VPC Peering module should be adding routes to those route tables. The trick here is to not create any routes in the
aws_route_tableresources, but create them all as separateaws_routeresources. Per the note in theaws_routedocumentation:So in order to define routes in multiple modules you will need to use the
aws_routeresource for all route definitions.