Can't Deploy Mutiple AR labs in same AWS account
While testing scaling of the lab for different team members, I ran into an issue deploying two different labs in the same AWS account/region. I have one AR lab up already. From a different server, I ran another attack range deployment.
The new Splunk server will not deploy and creating the IAM role errors out due to it already existing:
╷ │ Error: creating IAM Role (splunk_role_Splunk_attack_range_v3_ar): EntityAlreadyExists: Role with name splunk_role_Splunk_attack_range_v3_ar already exists. │ status code: 409, request id: 61897339-7f0f-4c1f-8cec-9701193728d3 │ │ with module.splunk-server.aws_iam_role.splunk_role[0], │ on modules/splunk-server/resources.tf line 30, in resource "aws_iam_role" "splunk_role": │ 30: resource "aws_iam_role" "splunk_role" { │ ╵
The result is only 3 servers and no Splunk instance being deployed:
Status Virtual Machines
Name Status IP Address
ar-linux-Splunk_attack_range_v3-ar-0 stopped ar-win-Splunk_attack_range_v3-ar-0 stopped ar-win-Splunk_attack_range_v3-ar-1 running 3.141.75.92 ar-splunk-Splunk_attack_range_v3-ar stopped ar-win-Splunk_attack_range_v3-ar-1 stopped ar-win-Splunk_attack_range_v3-ar-0 running 13.58.40.239 ar-linux-Splunk_attack_range_v3-ar-0 running 3.135.152.80
Access Windows via: RDP > rdp://3.141.75.92:3389 username: Administrator password: xxx
Access Windows via: RDP > rdp://13.58.40.239:3389 username: Administrator password: xxx
Access Linux via: SSH > ssh -i~/.ssh/Splunk_attack_range_v3.pem [email protected] username: ubuntu password: xxx
These servers in the attached file are the previous range deployment: ar-linux-Splunk_attack_range_v3-ar-0 stopped ar-win-Splunk_attack_range_v3-ar-0 stopped ar-splunk-Splunk_attack_range_v3-ar stopped ar-win-Splunk_attack_range_v3-ar-1 stopped
Recommendation would be to search for presence of IAM role and re-use or to simply update the naming convention of the IAM role to append the range_name to the name. In the above deployment the range name was "range_name: ar_adam". In the previous deployment it was "range_name: ar3".
Side note: Changing the field "range_name" on the original deployment also doesn't deploy a new lab as terraform still believes all the resources are there.
"No changes. Your infrastructure matches the configuration.
Your configuration already matches the changes detected above. If you'd like to update the Terraform state to match, create and apply a refresh-only plan: terraform apply -refresh-only
Apply complete! Resources: 0 added, 0 changed, 0 destroyed."
The combination of region and ssh key name is used as identifier. Please make sure to use different key names. The Threat Research Team in Splunk has multiple Attack Ranges running in the same region and account.
@P4T12ICK Can the documentation be updated to reflect this? From looking at the configuration file it just indicates that the name should be updated:
https://attack-range.readthedocs.io/en/latest/Attack_Range_Config.html
attack_range_name: "ar"
# Attack range Name let you build multiple Attack Ranges by changing this parameter.
I am going to redeploy and adjust the keys.
The extra deployment changing the key used worked, and I was able to deploy an additional lab.