You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@skywalking.apache.org by ke...@apache.org on 2023/08/21 07:48:56 UTC

[skywalking-terraform] branch polish created (now adffc1b)

This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a change to branch polish
in repository https://gitbox.apache.org/repos/asf/skywalking-terraform.git


      at adffc1b  Add variables for ak/sk

This branch includes the following new commits:

     new adffc1b  Add variables for ak/sk

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[skywalking-terraform] 01/01: Add variables for ak/sk

Posted by ke...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch polish
in repository https://gitbox.apache.org/repos/asf/skywalking-terraform.git

commit adffc1b8ebef3b2710d2c86f41ba58b22c46df68
Author: kezhenxu94 <ke...@apache.org>
AuthorDate: Mon Aug 21 15:48:46 2023 +0800

    Add variables for ak/sk
---
 aws/ec2.tf       | 60 +++++++++++++++++++++++++++++---------------------------
 aws/variables.tf | 10 ++++++++++
 2 files changed, 41 insertions(+), 29 deletions(-)

diff --git a/aws/ec2.tf b/aws/ec2.tf
index 934ec14..e2ad469 100644
--- a/aws/ec2.tf
+++ b/aws/ec2.tf
@@ -14,16 +14,18 @@
 # limitations under the License.
 
 provider "aws" {
-    region = var.region
+  region     = var.region
+  access_key = var.access_key
+  secret_key = var.secret_key
 }
 
 resource "aws_instance" "skywalking-oap" {
-  count = var.oap_instance_count
-  ami = data.aws_ami.amazon-linux.id
+  count         = var.oap_instance_count
+  ami           = data.aws_ami.amazon-linux.id
   instance_type = var.instance_type
   tags = merge(
     {
-      Name = "skywalking-oap"
+      Name        = "skywalking-oap"
       Description = "Installing and configuring SkyWalking OAPService on AWS"
     },
     var.extra_tags
@@ -36,12 +38,12 @@ resource "aws_instance" "skywalking-oap" {
 }
 
 resource "aws_instance" "skywalking-ui" {
-  count = var.ui_instance_count
-  ami = data.aws_ami.amazon-linux.id
+  count         = var.ui_instance_count
+  ami           = data.aws_ami.amazon-linux.id
   instance_type = var.instance_type
   tags = merge(
     {
-      Name = "skywalking-ui"
+      Name        = "skywalking-ui"
       Description = "Installing and configuring SkyWalking UI on AWS"
     },
     var.extra_tags
@@ -54,38 +56,38 @@ resource "aws_instance" "skywalking-ui" {
 }
 
 resource "aws_security_group" "ssh-access" {
-  name = "ssh-access"
+  name        = "ssh-access"
   description = "Allow SSH access from the Internet"
   ingress = [
     {
-      from_port = 22
-      to_port = 22
-      protocol = "tcp"
-      cidr_blocks = ["0.0.0.0/0"]
-      description     = "SSH access rule"
+      from_port        = 22
+      to_port          = 22
+      protocol         = "tcp"
+      cidr_blocks      = ["0.0.0.0/0"]
+      description      = "SSH access rule"
       ipv6_cidr_blocks = []
-      prefix_list_ids = []
-      security_groups = []
-      self            = false
+      prefix_list_ids  = []
+      security_groups  = []
+      self             = false
     }
   ]
   tags = var.extra_tags
 }
 
 resource "aws_security_group" "public-egress-access" {
-  name = "public-egress-access"
+  name        = "public-egress-access"
   description = "Allow access to the Internet"
   egress = [
     {
-      from_port = 0
-      to_port = 0
-      protocol = -1
-      cidr_blocks = ["0.0.0.0/0"]
-      description     = "Allow access to the Internet"
+      from_port        = 0
+      to_port          = 0
+      protocol         = -1
+      cidr_blocks      = ["0.0.0.0/0"]
+      description      = "Allow access to the Internet"
       ipv6_cidr_blocks = []
-      prefix_list_ids = []
-      security_groups = []
-      self            = false
+      prefix_list_ids  = []
+      security_groups  = []
+      self             = false
     }
   ]
   tags = var.extra_tags
@@ -96,9 +98,9 @@ resource "local_file" "oap_instance_ips" {
   content = join("\n", flatten([
     ["[skywalking_oap]"],
     aws_instance.skywalking-oap.*.public_ip,
-    [""]  # Adds an empty string for the trailing newline
+    [""] # Adds an empty string for the trailing newline
   ]))
-  filename = "${path.module}/../ansible/inventory/oap-server"
+  filename        = "${path.module}/../ansible/inventory/oap-server"
   file_permission = "0600"
 }
 
@@ -107,8 +109,8 @@ resource "local_file" "ui_instance_ips" {
   content = join("\n", flatten([
     ["[skywalking_ui]"],
     aws_instance.skywalking-ui.*.public_ip,
-    [""]  # Adds an empty string for the trailing newline
+    [""] # Adds an empty string for the trailing newline
   ]))
-  filename = "${path.module}/../ansible/inventory/ui-server"
+  filename        = "${path.module}/../ansible/inventory/ui-server"
   file_permission = "0600"
 }
diff --git a/aws/variables.tf b/aws/variables.tf
index 93eca98..92f2a3c 100644
--- a/aws/variables.tf
+++ b/aws/variables.tf
@@ -13,6 +13,16 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+variable "access_key" {
+  type    = string
+  default = ""
+}
+
+variable "secret_key" {
+  type    = string
+  default = ""
+}
+
 variable "oap_instance_count" {
   type    = number
   default = 1