File tree Expand file tree Collapse file tree 4 files changed +22
-63
lines changed Expand file tree Collapse file tree 4 files changed +22
-63
lines changed Original file line number Diff line number Diff line change @@ -16,34 +16,14 @@ resource "aws_vpc_security_group_ingress_rule" "nbc_allow_https_in" {
16
16
ip_protocol = " tcp"
17
17
}
18
18
19
- resource "aws_iam_role" "nbc_instance_role" {
20
- assume_role_policy = jsonencode ({
21
- Version = " 2012-10-17"
22
- Statement = [{
23
- Action = " sts:AssumeRole"
24
- Principal = { Service = " ec2.amazonaws.com" }
25
- Effect = " Allow"
26
- }]
27
- })
28
- }
29
-
30
- resource "aws_iam_role_policy_attachment" "nbc_ssm_policy_attachment" {
31
- role = aws_iam_role. nbc_instance_role . name
32
- policy_arn = " arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore"
33
- }
34
-
35
- resource "aws_iam_instance_profile" "nbc_instance_profile" {
36
- role = aws_iam_role. nbc_instance_role . name
37
- }
38
-
39
19
resource "aws_instance" "nbc_instance" {
40
20
ami = data. aws_ssm_parameter . al2023_ami_arm64 . value
41
21
instance_type = " t4g.xlarge"
42
22
subnet_id = module. vpc . public_subnets [0 ]
43
23
vpc_security_group_ids = [aws_security_group . nbc . id ]
44
24
user_data = file (" ${ path . module } /nbc.sh" )
45
25
associate_public_ip_address = true
46
- iam_instance_profile = aws_iam_instance_profile. nbc_instance_profile . name
26
+ iam_instance_profile = aws_iam_instance_profile. ssm_instance_profile . name
47
27
}
48
28
49
29
output "nbc_ssm_command" {
Original file line number Diff line number Diff line change @@ -32,26 +32,6 @@ resource "aws_vpc_security_group_ingress_rule" "nbe_allow_30k_in" {
32
32
ip_protocol = " tcp"
33
33
}
34
34
35
- resource "aws_iam_role" "nbe_instance_role" {
36
- assume_role_policy = jsonencode ({
37
- Version = " 2012-10-17"
38
- Statement = [{
39
- Action = " sts:AssumeRole"
40
- Principal = { Service = " ec2.amazonaws.com" }
41
- Effect = " Allow"
42
- }]
43
- })
44
- }
45
-
46
- resource "aws_iam_role_policy_attachment" "nbe_ssm_policy_attachment" {
47
- role = aws_iam_role. nbe_instance_role . name
48
- policy_arn = " arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore"
49
- }
50
-
51
- resource "aws_iam_instance_profile" "nbe_instance_profile" {
52
- role = aws_iam_role. nbe_instance_role . name
53
- }
54
-
55
35
resource "aws_instance" "nbe_instance" {
56
36
ami = data. aws_ssm_parameter . al2023_ami_x86-64 . value
57
37
instance_type = " m7i.2xlarge"
@@ -65,7 +45,7 @@ resource "aws_instance" "nbe_instance" {
65
45
})
66
46
})
67
47
associate_public_ip_address = true
68
- iam_instance_profile = aws_iam_instance_profile. nbe_instance_profile . name
48
+ iam_instance_profile = aws_iam_instance_profile. ssm_instance_profile . name
69
49
70
50
root_block_device {
71
51
volume_size = 100
Original file line number Diff line number Diff line change @@ -8,26 +8,6 @@ resource "aws_vpc_security_group_egress_rule" "orb_allow_all_out" {
8
8
ip_protocol = " -1"
9
9
}
10
10
11
- resource "aws_iam_role" "orb_instance_role" {
12
- assume_role_policy = jsonencode ({
13
- Version = " 2012-10-17"
14
- Statement = [{
15
- Action = " sts:AssumeRole"
16
- Principal = { Service = " ec2.amazonaws.com" }
17
- Effect = " Allow"
18
- }]
19
- })
20
- }
21
-
22
- resource "aws_iam_role_policy_attachment" "orb_ssm_policy_attachment" {
23
- role = aws_iam_role. orb_instance_role . name
24
- policy_arn = " arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore"
25
- }
26
-
27
- resource "aws_iam_instance_profile" "orb_instance_profile" {
28
- role = aws_iam_role. orb_instance_role . name
29
- }
30
-
31
11
resource "aws_instance" "orb_instance" {
32
12
ami = data. aws_ssm_parameter . al2023_ami_arm64 . value
33
13
instance_type = " t4g.large"
@@ -40,7 +20,7 @@ resource "aws_instance" "orb_instance" {
40
20
})
41
21
})
42
22
associate_public_ip_address = true
43
- iam_instance_profile = aws_iam_instance_profile. orb_instance_profile . name
23
+ iam_instance_profile = aws_iam_instance_profile. ssm_instance_profile . name
44
24
}
45
25
46
26
output "orb_ssm_command" {
Original file line number Diff line number Diff line change
1
+ resource "aws_iam_role" "ssm_instance_role" {
2
+ assume_role_policy = jsonencode ({
3
+ Version = " 2012-10-17"
4
+ Statement = [{
5
+ Action = " sts:AssumeRole"
6
+ Principal = { Service = " ec2.amazonaws.com" }
7
+ Effect = " Allow"
8
+ }]
9
+ })
10
+ }
11
+
12
+ resource "aws_iam_role_policy_attachment" "ssm_policy_attachment" {
13
+ role = aws_iam_role. ssm_instance_role . name
14
+ policy_arn = " arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore"
15
+ }
16
+
17
+ resource "aws_iam_instance_profile" "ssm_instance_profile" {
18
+ role = aws_iam_role. ssm_instance_role . name
19
+ }
You can’t perform that action at this time.
0 commit comments