# Import existing AWS resources to Terraform for the Datadog integration
Datadog needs a few [AWS resources](https://docs.datadoghq.com/integrations/faq/aws-integration-with-terraform/) to be able to connect and start working properly. The SRE team wrote a [Terraform module](https://github.com/ElectricAI/terraform-aws-datadog_integration/pull/1) to create these resources easily and programmatically. If these resources were created manually through the console (during a PoC for example), there's a simple way to make Terraform aware of these resources.
There are three key resources that need to be imported:
1. `aws_iam_policy`
2. `aws_iam_role`
3. `aws_iam_role_policy_attachment`
Run these commands inside the project folder:
```bash
export TF_VAR_aws_profile=<AWS_PROFILE>
terraform import module.datadog_integration.aws_iam_policy.datadog_aws_integration <POLICY_ARN>
terraform import module.datadog_integration.aws_iam_role.datadog_aws_integration <ROLE_NAME>
terraform import module.datadog_integration.aws_iam_role_policy_attachment.datadog_aws_integration <ROLE_NAME>/<POLICY_ARN>
```
## Docs
- https://docs.datadoghq.com/integrations/amazon_web_services/
- https://www.terraform.io/docs/providers/aws/r/iam_policy.html#import
- https://www.terraform.io/docs/providers/aws/r/iam_role.html#import
- https://www.terraform.io/docs/providers/aws/r/iam_role_policy_attachment.html#import