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

lfrolov pushed a commit to branch DATALAB-2969
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git


The following commit(s) were added to refs/heads/DATALAB-2969 by this push:
     new de4a2416d [DATALAB-2969]: moved back to single sg
de4a2416d is described below

commit de4a2416df10aa48c4deaa08551a818cbd6b580e
Author: leonidfrolov <[email protected]>
AuthorDate: Mon Aug 15 15:13:53 2022 +0300

    [DATALAB-2969]: moved back to single sg
---
 infrastructure-provisioning/terraform/aws/endpoint/main/instance.tf | 2 +-
 infrastructure-provisioning/terraform/aws/endpoint/main/network.tf  | 6 +++---
 .../terraform/aws/endpoint/main/variables.tf                        | 5 ++---
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git 
a/infrastructure-provisioning/terraform/aws/endpoint/main/instance.tf 
b/infrastructure-provisioning/terraform/aws/endpoint/main/instance.tf
index b569898a1..36d9510ce 100644
--- a/infrastructure-provisioning/terraform/aws/endpoint/main/instance.tf
+++ b/infrastructure-provisioning/terraform/aws/endpoint/main/instance.tf
@@ -28,7 +28,7 @@ resource "aws_instance" "endpoint" {
   instance_type        = var.endpoint_instance_shape
   key_name             = var.key_name
   subnet_id            = data.aws_subnet.data_subnet.id
-  security_groups      = data.aws_instance.data_sg.security_groups
+  security_groups      = data.aws_security_group.data_sg.id
   iam_instance_profile = aws_iam_instance_profile.endpoint_profile.name
   root_block_device {
     volume_type           = "gp2"
diff --git a/infrastructure-provisioning/terraform/aws/endpoint/main/network.tf 
b/infrastructure-provisioning/terraform/aws/endpoint/main/network.tf
index 23b197a07..0fdb419a3 100644
--- a/infrastructure-provisioning/terraform/aws/endpoint/main/network.tf
+++ b/infrastructure-provisioning/terraform/aws/endpoint/main/network.tf
@@ -85,7 +85,7 @@ resource "aws_route" "route" {
 
 resource "aws_security_group" "endpoint_sec_group" {
   name        = local.endpoint_sg_name
-  count       = var.sg_ids == "" ? 1 : 0
+  count       = var.sg_id == "" ? 1 : 0
   vpc_id      = data.aws_vpc.data_vpc.id
   ingress {
     from_port   = 22
@@ -144,8 +144,8 @@ resource "aws_security_group" "endpoint_sec_group" {
   }
 }
 
-data "aws_instance" "data_sg" {
-  security_groups = var.sg_ids == "" ? 
[aws_security_group.endpoint_sec_group[1].id] : var.sg_ids
+data "aws_security_group" "data_sg" {
+  id = var.sg_id == "" ? aws_security_group.endpoint_sec_group[1].id : 
var.sg_id
 }
 
 resource "aws_eip" "endpoint_eip" {
diff --git 
a/infrastructure-provisioning/terraform/aws/endpoint/main/variables.tf 
b/infrastructure-provisioning/terraform/aws/endpoint/main/variables.tf
index 28cece504..9c89bcdba 100644
--- a/infrastructure-provisioning/terraform/aws/endpoint/main/variables.tf
+++ b/infrastructure-provisioning/terraform/aws/endpoint/main/variables.tf
@@ -53,9 +53,8 @@ variable "vpc_id" {
   default = ""
 }
 
-variable "sg_ids" {
-  type    = list(string)
-  default = [""]
+variable "sg_id" {
+  default = ""
 }
 
 variable "subnet_id" {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to