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/06/11 03:46:54 UTC

[skywalking-terraform] branch main updated: Dynamically add ip-adress to hosts file from aws machine (#4)

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

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


The following commit(s) were added to refs/heads/main by this push:
     new b7ed668  Dynamically add ip-adress to hosts file from aws machine (#4)
b7ed668 is described below

commit b7ed668fa745f419bb4e5deb06264fc296e5d662
Author: Rahul Bajaj <ra...@gmail.com>
AuthorDate: Sat Jun 10 23:46:48 2023 -0400

    Dynamically add ip-adress to hosts file from aws machine (#4)
---
 .gitignore              |  1 +
 ansible/inventory/hosts | 14 --------------
 aws/ec2.tf              |  5 +++++
 3 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/.gitignore b/.gitignore
index a7da9fa..74ae3e1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,6 +22,7 @@ aws/.terraform/
 aws/.terraform.lock.hcl
 aws/terraform.tfstate
 aws/terraform.tfstate.backup
+ansible/inventory/hosts
 
 # This serves as a template but will ONLY be updated when building a source release tar,
 # so we don't track future updates of this file.
diff --git a/ansible/inventory/hosts b/ansible/inventory/hosts
deleted file mode 100644
index ae1e83e..0000000
--- a/ansible/inventory/hosts
+++ /dev/null
@@ -1,14 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
diff --git a/aws/ec2.tf b/aws/ec2.tf
index 8ecde8c..a7a1bb9 100644
--- a/aws/ec2.tf
+++ b/aws/ec2.tf
@@ -49,3 +49,8 @@ resource "aws_security_group" "ssh-access" {
 resource "aws_key_pair" "ssh-user" {
     public_key = file(var.public_key_path)
 }
+
+resource "local_file" "write_to_host_file" {
+  content  = "[skywalking-machine]\n${aws_instance.skywalking.public_ip}"
+  filename = "${path.module}/../ansible/inventory/hosts"
+}