This is an example regarding spinning up with terraform and managing it with Ansible.
Follow the below steps for this to work.
Requirement:
- An AWS account
- Terraform CLI
- Ansible CLI
AWS Steps:
-
Go to AWS and navigate to Secrets Manager. And Go to the selected region you want.
-
Create an new Secret and select "Other type of secret"
-
In Key field type in "password" and with value you can put whatever password you want to keep.
-
Name the secret as : "admin_pwd"
-
Configure the default profile or else you can change in the
Now for Terraform:
- Clone the Repo
git clone https://github.com/Dash2701/terraform-ansible-windows-ec2.git
- Navigate to the folder
cd terraform-ansible-windows-ec2
- Replace your account Number and region in terraform.tfvars and then Initialize the terraform
terraform init
- Run Terraform Apply and after plan check input yes
terraform apply
or for auto approve
terraform apply --auto-approve
- Now in you use ansible basic authentication with username as Administrator and password with the one you have set in secrets manager