Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE: Add etcd rolling update document #132

Merged
merged 1 commit into from
Sep 27, 2021
Merged

Conversation

smalltown
Copy link
Contributor

@smalltown smalltown commented Sep 27, 2021

  • Add document for how to rolling update etcd cluster
  • Change external module source include method
  • Only add ssh key pair for K8s node when debug_node is true

Copy link

@bridgecrew bridgecrew bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bridgecrew has found 8 infrastructure configuration errors in this PR ⬇️

@@ -99,7 +99,7 @@ resource "aws_launch_template" "master" {
arn = aws_iam_instance_profile.master.arn
}

key_name = var.ssh_key
key_name = var.debug_mode ? var.ssh_key : ""
Copy link

@bridgecrew bridgecrew bot Sep 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOW   AWS resources that support tags do not have Tags
    Resource: aws_launch_template.master | ID: BC_AWS_GENERAL_26

How to Fix

resource "aws_security_group" "sg" {
  name = "my-sg"
  ...
+ tags = {
+   Environment = "dev"
+   Owner = "apps-team"
+ }
}

Description

Many different types of AWS resources support tags. Tags allow you to add metadata to a resource to help identify ownership, perform cost / billing analysis, and to enrich a resource with other valuable information, such as descriptions and environment names. While there are many ways that tags can be used, we recommend you follow a tagging practice.

View AWS's recommended tagging best practices here.

Dependent Resources



Path Resource Connecting Attribute
/modules/aws/kube-master/main.tf aws_autoscaling_group.master mixed_instances_policy.launch_template.launch_template_specification.launch_template_id

@@ -99,7 +99,7 @@ resource "aws_launch_template" "master" {
arn = aws_iam_instance_profile.master.arn
}

key_name = var.ssh_key
key_name = var.debug_mode ? var.ssh_key : ""
Copy link

@bridgecrew bridgecrew bot Sep 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOW   Instance Metadata Service version 1 is enabled
    Resource: aws_launch_template.master | ID: BC_AWS_GENERAL_31

How to Fix

resource "aws_instance" "example" {
  ...
  instance_type     = "t2.micro"
+   metadata_options {
        ...
+       http_endpoint = "enabled"
+       http_tokens   = "required"
+  }
  ...
}

Description

The Instance Metadata Service (IMDS) is an on-instance component used by code on the instance to securely access instance metadata. You can access instance metadata from a running instance using one of the following methods: * Instance Metadata Service Version 1 (IMDSv1) – a request/response method * Instance Metadata Service Version 2 (IMDSv2) – a session-oriented method

As a request/response method IMDSv1 is prone to local misconfigurations:

  • Open proxies, open NATs and routers, server-side reflection vulnerabilities.
  • One way or another, local software might access local-only data.

Benchmarks

  • FEDRAMP (MODERATE) AC-6
Dependent Resources

Path Resource Connecting Attribute
/modules/aws/kube-master/main.tf aws_autoscaling_group.master mixed_instances_policy.launch_template.launch_template_specification.launch_template_id

@@ -80,7 +80,7 @@ resource "aws_instance" "etcd" {

ami = var.instance_config["image_id"]
instance_type = var.instance_config["ec2_type"]
key_name = var.ssh_key
key_name = var.debug_mode ? var.ssh_key : ""
Copy link

@bridgecrew bridgecrew bot Sep 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOW   Instance Metadata Service version 1 is enabled
    Resource: aws_instance.etcd | ID: BC_AWS_GENERAL_31

How to Fix

resource "aws_instance" "example" {
  ...
  instance_type     = "t2.micro"
+   metadata_options {
        ...
+       http_endpoint = "enabled"
+       http_tokens   = "required"
+  }
  ...
}

Description

The Instance Metadata Service (IMDS) is an on-instance component used by code on the instance to securely access instance metadata. You can access instance metadata from a running instance using one of the following methods: * Instance Metadata Service Version 1 (IMDSv1) – a request/response method * Instance Metadata Service Version 2 (IMDSv2) – a session-oriented method

As a request/response method IMDSv1 is prone to local misconfigurations:

  • Open proxies, open NATs and routers, server-side reflection vulnerabilities.
  • One way or another, local software might access local-only data.

Benchmarks

  • FEDRAMP (MODERATE) AC-6
Dependent Resources

Path Resource Connecting Attribute
/modules/aws/kube-etcd/main.tf aws_volume_attachment.etcd instance_id

@@ -80,7 +80,7 @@ resource "aws_instance" "etcd" {

ami = var.instance_config["image_id"]
instance_type = var.instance_config["ec2_type"]
key_name = var.ssh_key
key_name = var.debug_mode ? var.ssh_key : ""
Copy link

@bridgecrew bridgecrew bot Sep 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HIGH   EBS volumes do not have encrypted launch configurations
    Resource: aws_instance.etcd | ID: BC_AWS_GENERAL_13

How to Fix

resource "aws_launch_configuration" "example" {
  ...
  instance_type = "t2.micro"
+ root_block_device {
+ encrypted     = true
+ }
  ...
}

Description

Amazon Elastic Block Store (EBS) volumes allow you to create encrypted launch configurations when creating EC2 instances and auto scaling. When the entire EBS volume is encrypted, data stored at rest on the volume, disk I/O, snapshots created from the volume, and data in-transit between EBS and EC2 are all encrypted.

Benchmarks

  • PCI-DSS V3.2 3
Dependent Resources

Path Resource Connecting Attribute
/modules/aws/kube-etcd/main.tf aws_volume_attachment.etcd instance_id

@@ -80,7 +80,7 @@ resource "aws_instance" "etcd" {

ami = var.instance_config["image_id"]
instance_type = var.instance_config["ec2_type"]
key_name = var.ssh_key
key_name = var.debug_mode ? var.ssh_key : ""
Copy link

@bridgecrew bridgecrew bot Sep 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOW   EC2 EBS is not optimized
    Resource: aws_instance.etcd | ID: BC_AWS_GENERAL_68

How to Fix

resource "aws_instance" "foo" {
  ...
+ ebs_optimized = true
}

Description

TBA

Dependent Resources



Path Resource Connecting Attribute
/modules/aws/kube-etcd/main.tf aws_volume_attachment.etcd instance_id

@@ -113,7 +113,7 @@ resource "aws_launch_template" "worker" {
arn = aws_iam_instance_profile.worker.arn
}

key_name = var.ssh_key
key_name = var.debug_mode ? var.ssh_key : ""
Copy link

@bridgecrew bridgecrew bot Sep 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOW   Instance Metadata Service version 1 is enabled
    Resource: aws_launch_template.worker | ID: BC_AWS_GENERAL_31

How to Fix

resource "aws_instance" "example" {
  ...
  instance_type     = "t2.micro"
+   metadata_options {
        ...
+       http_endpoint = "enabled"
+       http_tokens   = "required"
+  }
  ...
}

Description

The Instance Metadata Service (IMDS) is an on-instance component used by code on the instance to securely access instance metadata. You can access instance metadata from a running instance using one of the following methods: * Instance Metadata Service Version 1 (IMDSv1) – a request/response method * Instance Metadata Service Version 2 (IMDSv2) – a session-oriented method

As a request/response method IMDSv1 is prone to local misconfigurations:

  • Open proxies, open NATs and routers, server-side reflection vulnerabilities.
  • One way or another, local software might access local-only data.

Benchmarks

  • FEDRAMP (MODERATE) AC-6
Dependent Resources

Path Resource Connecting Attribute
/modules/aws/kube-worker/main.tf aws_autoscaling_group.worker mixed_instances_policy.launch_template.launch_template_specification.launch_template_id

@@ -113,7 +113,7 @@ resource "aws_launch_template" "worker" {
arn = aws_iam_instance_profile.worker.arn
}

key_name = var.ssh_key
key_name = var.debug_mode ? var.ssh_key : ""
Copy link

@bridgecrew bridgecrew bot Sep 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOW   AWS resources that support tags do not have Tags
    Resource: aws_launch_template.worker | ID: BC_AWS_GENERAL_26

How to Fix

resource "aws_security_group" "sg" {
  name = "my-sg"
  ...
+ tags = {
+   Environment = "dev"
+   Owner = "apps-team"
+ }
}

Description

Many different types of AWS resources support tags. Tags allow you to add metadata to a resource to help identify ownership, perform cost / billing analysis, and to enrich a resource with other valuable information, such as descriptions and environment names. While there are many ways that tags can be used, we recommend you follow a tagging practice.

View AWS's recommended tagging best practices here.

Dependent Resources



Path Resource Connecting Attribute
/modules/aws/kube-worker/main.tf aws_autoscaling_group.worker mixed_instances_policy.launch_template.launch_template_specification.launch_template_id

@@ -80,7 +80,7 @@ resource "aws_instance" "etcd" {

ami = var.instance_config["image_id"]
instance_type = var.instance_config["ec2_type"]
key_name = var.ssh_key
key_name = var.debug_mode ? var.ssh_key : ""
Copy link

@bridgecrew bridgecrew bot Sep 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MEDIUM   Detailed monitoring for EC2 instances is disabled
    Resource: aws_instance.etcd | ID: BC_AWS_LOGGING_26

How to Fix

 resource "aws_instance" "test" {
+  monitoring = true   
 }

Description

TBA

Dependent Resources



Path Resource Connecting Attribute
/modules/aws/kube-etcd/main.tf aws_volume_attachment.etcd instance_id

@smalltown smalltown merged commit 61a6518 into master Sep 27, 2021
@smalltown smalltown deleted the feature/etcd_update_doc branch September 27, 2021 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant