@@ -33,6 +33,40 @@ locals {
3333 ssm_parameter_name = " WindowsAgentConfigSSMTest-${ module . common . testing_id } "
3434}
3535
36+ # ####################################################################
37+ # Per-run Security Group for WinRM access from CI runner
38+ # ####################################################################
39+
40+ resource "aws_security_group" "winrm_runner" {
41+ name = " cwagent-integ-win-sg-${ module . common . testing_id } "
42+ description = " WinRM access from CI runner for test ${ module . common . testing_id } "
43+ vpc_id = module. basic_components . vpc_id
44+
45+ ingress {
46+ description = " WinRM HTTP from CI runner"
47+ from_port = 5985
48+ to_port = 5985
49+ protocol = " tcp"
50+ cidr_blocks = [var . runner_ip ]
51+ }
52+
53+ ingress {
54+ description = " WinRM HTTPS from CI runner"
55+ from_port = 5986
56+ to_port = 5986
57+ protocol = " tcp"
58+ cidr_blocks = [var . runner_ip ]
59+ }
60+
61+ ingress {
62+ description = " RDP from CI runner"
63+ from_port = 3389
64+ to_port = 3389
65+ protocol = " tcp"
66+ cidr_blocks = [var . runner_ip ]
67+ }
68+ }
69+
3670# ####################################################################
3771# Prepare Parameters Tests
3872# ####################################################################
@@ -59,7 +93,7 @@ resource "aws_instance" "cwagent" {
5993 instance_type = var. ec2_instance_type
6094 key_name = local. ssh_key_name
6195 iam_instance_profile = module. basic_components . instance_profile
62- vpc_security_group_ids = [module . basic_components . security_group ]
96+ vpc_security_group_ids = [module . basic_components . security_group , aws_security_group . winrm_runner . id ]
6397 associate_public_ip_address = true
6498 instance_initiated_shutdown_behavior = " terminate"
6599 user_data = length (regexall (" /feature/windows/custom_start/userdata" , var. test_dir )) > 0 ? data. template_file . user_data . rendered : " "
0 commit comments