1414# limitations under the License.
1515
1616provider "aws" {
17- region = var. region
17+ region = var. region
18+ access_key = var. access_key
19+ secret_key = var. secret_key
1820}
1921
2022resource "aws_instance" "skywalking-oap" {
21- count = var. oap_instance_count
22- ami = data. aws_ami . amazon-linux . id
23+ count = var. oap_instance_count
24+ ami = data. aws_ami . amazon-linux . id
2325 instance_type = var. instance_type
2426 tags = merge (
2527 {
26- Name = " skywalking-oap"
28+ Name = " skywalking-oap"
2729 Description = " Installing and configuring SkyWalking OAPService on AWS"
2830 },
2931 var. extra_tags
@@ -37,12 +39,12 @@ resource "aws_instance" "skywalking-oap" {
3739}
3840
3941resource "aws_instance" "skywalking-ui" {
40- count = var. ui_instance_count
41- ami = data. aws_ami . amazon-linux . id
42+ count = var. ui_instance_count
43+ ami = data. aws_ami . amazon-linux . id
4244 instance_type = var. instance_type
4345 tags = merge (
4446 {
45- Name = " skywalking-ui"
47+ Name = " skywalking-ui"
4648 Description = " Installing and configuring SkyWalking UI on AWS"
4749 },
4850 var. extra_tags
@@ -55,38 +57,38 @@ resource "aws_instance" "skywalking-ui" {
5557}
5658
5759resource "aws_security_group" "ssh-access" {
58- name = " ssh-access"
60+ name = " ssh-access"
5961 description = " Allow SSH access from the Internet"
6062 ingress = [
6163 {
62- from_port = 22
63- to_port = 22
64- protocol = " tcp"
65- cidr_blocks = [" 0.0.0.0/0" ]
66- description = " SSH access rule"
64+ from_port = 22
65+ to_port = 22
66+ protocol = " tcp"
67+ cidr_blocks = [" 0.0.0.0/0" ]
68+ description = " SSH access rule"
6769 ipv6_cidr_blocks = []
68- prefix_list_ids = []
69- security_groups = []
70- self = false
70+ prefix_list_ids = []
71+ security_groups = []
72+ self = false
7173 }
7274 ]
7375 tags = var. extra_tags
7476}
7577
7678resource "aws_security_group" "public-egress-access" {
77- name = " public-egress-access"
79+ name = " public-egress-access"
7880 description = " Allow access to the Internet"
7981 egress = [
8082 {
81- from_port = 0
82- to_port = 0
83- protocol = - 1
84- cidr_blocks = [" 0.0.0.0/0" ]
85- description = " Allow access to the Internet"
83+ from_port = 0
84+ to_port = 0
85+ protocol = - 1
86+ cidr_blocks = [" 0.0.0.0/0" ]
87+ description = " Allow access to the Internet"
8688 ipv6_cidr_blocks = []
87- prefix_list_ids = []
88- security_groups = []
89- self = false
89+ prefix_list_ids = []
90+ security_groups = []
91+ self = false
9092 }
9193 ]
9294 tags = var. extra_tags
@@ -96,10 +98,10 @@ resource "aws_security_group" "ui-to-oap-communication" {
9698 name = " ui-to-oap-communication"
9799 description = " Allow communication from SkyWalking UI to SkyWalking OAP"
98100 ingress {
99- from_port = 0
100- to_port = 12800
101- protocol = " tcp"
102- cidr_blocks = [" 0.0.0.0/0" ]
101+ from_port = 0
102+ to_port = 12800
103+ protocol = " tcp"
104+ cidr_blocks = [" 0.0.0.0/0" ]
103105 security_groups = [aws_security_group . public-egress-access . id ]
104106 }
105107 tags = var. extra_tags
@@ -110,9 +112,9 @@ resource "local_file" "oap_instance_ips" {
110112 content = join (" \n " , flatten ([
111113 [" [skywalking_oap]" ],
112114 aws_instance . skywalking-oap . * . public_ip ,
113- [" " ] # Adds an empty string for the trailing newline
115+ [" " ] # Adds an empty string for the trailing newline
114116 ]))
115- filename = " ${ path . module } /../ansible/inventory/oap-server"
117+ filename = " ${ path . module } /../ansible/inventory/oap-server"
116118 file_permission = " 0600"
117119}
118120
@@ -121,8 +123,8 @@ resource "local_file" "ui_instance_ips" {
121123 content = join (" \n " , flatten ([
122124 [" [skywalking_ui]" ],
123125 aws_instance . skywalking-ui . * . public_ip ,
124- [" " ] # Adds an empty string for the trailing newline
126+ [" " ] # Adds an empty string for the trailing newline
125127 ]))
126- filename = " ${ path . module } /../ansible/inventory/ui-server"
128+ filename = " ${ path . module } /../ansible/inventory/ui-server"
127129 file_permission = " 0600"
128130}
0 commit comments