# How can I start managing already existing cloud resources using terraform?

**URL:** <https://discuss.hashicorp.com/t/how-can-i-start-managing-already-existing-cloud-resources-using-terraform/63145>\
**Category:** Terraform\
**Tags:** hcp-terraform\
**Created:** [February 26, 2024, 9:24am UTC](https://discuss.hashicorp.com/t/how-can-i-start-managing-already-existing-cloud-resources-using-terraform/63145 "2024-02-26T09:24:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![perceptronnn](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/perceptronnn/32/26590_2.png) [@perceptronnn](https://discuss.hashicorp.com/u/perceptronnn)\
**Post date:** [February 26, 2024, 9:24am UTC](https://discuss.hashicorp.com/t/how-can-i-start-managing-already-existing-cloud-resources-using-terraform/63145/1 "2024-02-26T09:24:20Z")

</div>

Currently, we have a set of Terraforms which are being used to deploy resources to AWS cloud for our cloud infrastructure. We also have some old infrastructure in AWS which was not built using Terraform, and hence we do not have any terraform state files for those cloud resources. We are exploring how we can start managing these old non-terraform built cloud resources using our current set of terraforms.

Our idea is to explore:

- if we can align whatever is there in the cloud(old non-terraform built resources) with our set of terraforms.
- capture the current state of these resources in a terraform state files so that we can start managing these using terraforms.

Does this seem to be a reasonable approach? Any recommendations on how exactly this should be done and/or if there are any alternative approaches?

---

<div class="post-metadata">

**Author:** ![ausmartway](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/ausmartway/32/10504_2.png) [@ausmartway](https://discuss.hashicorp.com/u/ausmartway)\
**Post date:** [February 26, 2024, 10:39am UTC](https://discuss.hashicorp.com/t/how-can-i-start-managing-already-existing-cloud-resources-using-terraform/63145/2 "2024-02-26T10:39:58Z")

</div>

have you tried this?

> **[GitHub - GoogleCloudPlatform/terraformer: CLI tool to generate terraform...](https://github.com/GoogleCloudPlatform/terraformer)**
>
> CLI tool to generate terraform files from existing infrastructure (reverse Terraform). Infrastructure to Code - GoogleCloudPlatform/terraformer

---

<div class="post-metadata">

**Author:** ![perceptronnn](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/perceptronnn/32/26590_2.png) [@perceptronnn](https://discuss.hashicorp.com/u/perceptronnn)\
**Post date:** [February 26, 2024, 10:54am UTC](https://discuss.hashicorp.com/t/how-can-i-start-managing-already-existing-cloud-resources-using-terraform/63145/3 "2024-02-26T10:54:53Z")

</div>

Thanks @ausmartway, wasn’t aware of this!

---

<div class="post-metadata">

**Author:** ![jlj7](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/jlj7/32/18330_2.png) [@jlj7](https://discuss.hashicorp.com/u/jlj7)\
**Post date:** [February 27, 2024, 3:07pm UTC](https://discuss.hashicorp.com/t/how-can-i-start-managing-already-existing-cloud-resources-using-terraform/63145/4 "2024-02-27T15:07:19Z")

</div>

Importing existing resources to Terraform has come a long way in recent years. (@ausmartway is absolutely right to point to _Terraformer;_ they filled a gap that existed in just about everyone’s use of Terraform for many years.) Now, in addition to generating state for any infrastructure you ask Terraform to import, it can optionally generate corresponding HCL as well, with the `-generate-config-out` flag.

Check out [the relevant documentation](https://developer.hashicorp.com/terraform/language/import/generating-configuration), and [a tutorial to practice](https://developer.hashicorp.com/terraform/tutorials/state/state-import), for more details. Good luck!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/hashicorp/original/1X/79bf76adfd92a75631996933098f9ce29d37abf3.svg) [@system](https://discuss.hashicorp.com/u/system)\
**Post date:** [August 25, 2024, 3:08pm UTC](https://discuss.hashicorp.com/t/how-can-i-start-managing-already-existing-cloud-resources-using-terraform/63145/5 "2024-08-25T15:08:12Z")

</div>

Closed on August 25, 2024, 3:08pm UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
