# terraform-ows-assets

This repo describes the Fargate environment. This migration was executed according to the steps outlined in this document

https://docs.google.com/document/d/1TZFlpB5vvMJv0eLxL2hYsO-587GNMhil-Ia4KoJX7JM/edit#


#### Policy Imports
Importing the SecretsManager policy that is already used by the ElasticBeanstalk environment.

```
terraform import module.ows_assets_fargate_environment.aws_iam_policy.fargate_secrets_manager_policy arn:aws:iam::437795906767:policy/SecretsManager-qa-ows-assets-policy
```

Importing the Dynamodb policy that is already used by the ElasticBeanstalk environment.
```
terraform import module.ows_assets_owsrequest.aws_iam_policy.owsrequest_policy arn:aws:iam::437795906767:policy/Dynamo-qa-ows-assets-owsrequest
```

The following commands, as explained in the doc, will return the policies used  by the existing elasticbeanstalk service before the migration. This is reiterated here for clarity
```
IAM_ROLE=$(aws elasticbeanstalk describe-configuration-settings --environment-name qa-ows-assets-ecr --region us-east-1 --application-name ows-assets --query 'ConfigurationSettings[*].[OptionSettings[?OptionName==`IamInstanceProfile`]]' --output text | awk '{print $4}')

aws iam list-attached-role-policies --role-name ${IAM_ROLE} --query 'AttachedPolicies[*].PolicyArn' --output text
```