-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Terraforming multiple AWS Regions #870
Comments
In your scenario, if you don't have shared resources depending on one
|
Yes! This is the simple switch that I couldn't find. Thank you @pmoust. |
I realise this issue is closed, but its the only forum I've found to discuss this use case, can one use multiple state files with remote state ? I'm also considering turning my code into a module and executing it once per region within one terraform script.. This keeps all my architecture as code, and means other collaborators don't need to remember my command line arguments in order to change the respective regions architecture.. Does this make sense to anyone else ? Also if there's a better place to discuss this let me know.. Thanks |
@farridav, it is possible, although in a bit hacky way. What we ended up doing is we have a wrapper script, which accepts account_name and some other parameters. We store TF state files under different keyprefixes in S3 (it goes something like It works reasonably well, although I feel that at this point it becomes a poor man's substitute for CloudFormation. |
I ended up doing exactly the same thing, wrapped terraform, and used multiple statefiles, it goes something like this:
I had battled for a little while trying to bend terraforms use of modules, and interpolation in region blocks, but it became a bit too messy for my liking, in the end I filled the holes with dynamic remote state, and and jinja2 templating.. It would be awesome if these kind of things were possible in native terraform, though it may be beyond what the tool was designed for |
@farridav , what do you use Jinja for? Is for dynamically substituting some values in the templates?
into
into
When we need to do a deploy of the same unit of infrastructure to a different region, we just use another |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
I'm opening this issue to get some feedback
provider "aws"
requiresregion=
.My topology is identical across regions.
I would like to only express the config for 1 region in my terraform scripts.
I would like to change "-var region=us-east-1" to "-var region=us-west-1" to target different regions, one at a time.
This seems better than including all regions' (80 some instances) config, split out and duplicated by region.
With simple TF scripts changing the
region
variable confuses terraform because itsterraform.tfstate
file only knows resources from the "other"(i.e. the first terraformed) region.I can't figure out how to do this correctly.
* Provider 'aws' error: region: required field is not set
, tried to set this numerous ways — this might be a bug…?So, is there some recommended way to do this that I missed?
Thanks for any insight.
The text was updated successfully, but these errors were encountered: