-
Notifications
You must be signed in to change notification settings - Fork 0
Master #1
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
Open
divyagovindaiah
wants to merge
10
commits into
main
Choose a base branch
from
master
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Master #1
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
095d9c2
first commit
divyagovindaiah 3e82aae
first commit
divyagovindaiah 6e04d4c
first commit
divyagovindaiah 2379384
first commit
divyagovindaiah 7cfff1c
first commit
divyagovindaiah c36b040
Delete terraform.tfstate.backup
divyagovindaiah 8b283cb
Delete terraform.tfstate
divyagovindaiah 3a128a1
Delete .terraform.lock.hcl
divyagovindaiah 0c2f4fd
Delete gitigonore
divyagovindaiah 79025d8
Delete README.md
divyagovindaiah File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| README.md | ||
| terraform.tfstate | ||
| terraform.tfstate.backup | ||
| /.terraform |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,182 @@ | ||
| resource "aws_cloudformation_stack" "network" { | ||
| name = "networking-stack" | ||
|
|
||
|
|
||
| template_body = <<STACK | ||
| { | ||
|
|
||
| "Resources" : { | ||
| "MyVpc": { | ||
| "Type" : "AWS::EC2::VPC", | ||
| "Properties" : { | ||
| "CidrBlock" : "10.0.0.0/16" | ||
|
|
||
| } | ||
| }, | ||
| "Subnet1": { | ||
| "Type" : "AWS::EC2::Subnet", | ||
| "Properties" : { | ||
| "VpcId" : {"Ref" : "MyVpc"}, | ||
| "CidrBlock": "10.0.0.0/24", | ||
| "AvailabilityZone": "ap-northeast-1a" | ||
| } | ||
| }, | ||
| "Subnet2": { | ||
| "Type" : "AWS::EC2::Subnet", | ||
| "Properties" : { | ||
| "VpcId" : {"Ref" : "MyVpc"}, | ||
| "CidrBlock" : "10.0.1.0/24", | ||
| "AvailabilityZone": "ap-northeast-1c" | ||
| } | ||
| }, | ||
| "Subnet3": { | ||
| "Type" : "AWS::EC2::Subnet", | ||
| "Properties" : { | ||
| "VpcId" : {"Ref" : "MyVpc"}, | ||
| "CidrBlock" : "10.0.2.0/24", | ||
| "AvailabilityZone": "ap-northeast-1d" | ||
| } | ||
| }, | ||
| "Securitygroup1": { | ||
| "Type": "AWS::EC2::SecurityGroup", | ||
| "Properties": { | ||
| "GroupDescription": "Securitygroup 1", | ||
| "VpcId" : {"Ref" : "MyVpc"}, | ||
| "SecurityGroupIngress" : [ | ||
| { | ||
| "IpProtocol" : "tcp", | ||
| "FromPort" : 22, | ||
| "ToPort" : 22, | ||
| "CidrIp" : "10.0.0.0/24" | ||
| }, | ||
| { | ||
| "IpProtocol" : "icmp", | ||
| "FromPort" : 8, | ||
| "ToPort" : -1, | ||
| "CidrIp" : "10.0.0.0/24" | ||
| }] | ||
|
|
||
| } | ||
| }, | ||
| "Securitygroup2": { | ||
| "Type": "AWS::EC2::SecurityGroup", | ||
| "Properties": { | ||
| "GroupDescription": "Securitygroup 2", | ||
| "VpcId" : {"Ref" : "MyVpc"}, | ||
| "SecurityGroupIngress" : [ | ||
| { | ||
| "IpProtocol" : "tcp", | ||
| "FromPort" : 22, | ||
| "ToPort" : 22, | ||
| "CidrIp" : "10.0.0.0/24" | ||
| }, | ||
| { | ||
| "IpProtocol" : "icmp", | ||
| "FromPort" : 8, | ||
| "ToPort" : -1, | ||
| "CidrIp" : "10.0.0.0/24" | ||
| }] | ||
|
|
||
| } | ||
| }, | ||
| "Securitygroup3": { | ||
| "Type": "AWS::EC2::SecurityGroup", | ||
| "Properties": { | ||
| "GroupDescription": "Securitygroup 2", | ||
| "VpcId" : {"Ref" : "MyVpc"}, | ||
| "SecurityGroupIngress" : [ | ||
| { | ||
| "IpProtocol" : "tcp", | ||
| "FromPort" : 22, | ||
| "ToPort" : 22, | ||
| "CidrIp" : "10.0.0.0/24" | ||
| }, | ||
| { | ||
| "IpProtocol" : "icmp", | ||
| "FromPort" : 8, | ||
| "ToPort" : -1, | ||
| "CidrIp" : "10.0.0.0/24" | ||
| }] | ||
|
|
||
| } | ||
| } | ||
| }, | ||
| "Outputs" : { | ||
| "MyVpc" :{ | ||
| "Value" : {"Ref" : "MyVpc"}, | ||
| "Export": { | ||
| "Name": "Vpc" | ||
| } | ||
| }, | ||
|
|
||
| "Subnet1" :{ | ||
| "Value" : {"Ref" : "Subnet1"}, | ||
| "Export": { | ||
| "Name": "Subnet1" | ||
| } | ||
| }, | ||
|
|
||
| "Subnet2" :{ | ||
| "Value" : {"Ref" : "Subnet2"}, | ||
| "Export": { | ||
| "Name": "Subnet2" | ||
| } | ||
| }, | ||
|
|
||
|
|
||
| "Subnet3" :{ | ||
| "Value" : {"Ref" : "Subnet3"}, | ||
| "Export": { | ||
| "Name": "Subnet3" | ||
| } | ||
| }, | ||
| "Securitygroup1" :{ | ||
| "Value" : {"Ref" : "Securitygroup1"}, | ||
| "Export": { | ||
| "Name": "Securitygroup1" | ||
| } | ||
| }, | ||
| "Securitygroup2" :{ | ||
| "Value" : {"Ref" : "Securitygroup2"}, | ||
| "Export": { | ||
| "Name": "Securitygroup2" | ||
| } | ||
| }, | ||
| "Securitygroup3" :{ | ||
| "Value" : {"Ref" : "Securitygroup3"}, | ||
| "Export": { | ||
| "Name": "Securitygroup3" | ||
| } | ||
| } | ||
|
|
||
|
|
||
|
|
||
| } | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| } | ||
| STACK | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| module "eks" { | ||
| source = "terraform-aws-modules/eks/aws" | ||
| version = "17.24.0" | ||
|
|
||
| cluster_name = "my-eks" | ||
| cluster_version = "1.21" | ||
|
|
||
|
|
||
| vpc_id = resource.aws_cloudformation_stack.network.outputs["MyVpc"] | ||
| subnet_ids = [resource.aws_cloudformation_stack.network.outputs["Subnet1"], | ||
| resource.aws_cloudformation_stack.network.outputs["Subnet2"]] | ||
|
|
||
|
|
||
|
|
||
|
|
||
| enable_irsa = true | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this necessary? |
||
|
|
||
| eks_managed_node_group_defaults = { | ||
| disk_size = 50 | ||
| } | ||
| } | ||
| resource "aws_iam_role" "workernodes" { | ||
| name = "eks-node-group-example" | ||
|
|
||
| assume_role_policy = jsonencode({ | ||
| Statement = [{ | ||
| Action = "sts:AssumeRole" | ||
| Effect = "Allow" | ||
| Principal = { | ||
| Service = "ec2.amazonaws.com" | ||
| } | ||
| }] | ||
| Version = "2012-10-17" | ||
| }) | ||
| } | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| resource "aws_msk_cluster" "example" { | ||
| cluster_name = "example" | ||
| kafka_version = "3.3.1" | ||
| number_of_broker_nodes = 3 | ||
|
|
||
|
|
||
|
|
||
| broker_node_group_info { | ||
| instance_type = "kafka.t3.small" | ||
| client_subnets = [resource.aws_cloudformation_stack.network.outputs["Subnet1"], | ||
| resource.aws_cloudformation_stack.network.outputs["Subnet2"], | ||
| resource.aws_cloudformation_stack.network.outputs["Subnet3"]] | ||
| security_groups = [resource.aws_cloudformation_stack.network.outputs["Securitygroup1"], | ||
| resource.aws_cloudformation_stack.network.outputs["Securitygroup2"], | ||
| resource.aws_cloudformation_stack.network.outputs["Securitygroup1"]] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you need 3 security groups? |
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| } | ||
| } | ||
|
|
||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| output "zookeeper_connect_string" { | ||
| value = aws_msk_cluster.example.zookeeper_connect_string | ||
| } | ||
|
|
||
| output "bootstrap_brokers_tls" { | ||
| description = "TLS connection host:port pairs" | ||
| value = aws_msk_cluster.example.bootstrap_brokers_tls | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| terraform { | ||
| required_providers { | ||
| aws = { | ||
| source = "hashicorp/aws" | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| resource "aws_iam_role" "eks-iam-role" { | ||
| name = "devopsthehardway-eks-iam-role" | ||
|
|
||
| path = "/" | ||
|
|
||
| assume_role_policy = jsonencode( | ||
| { | ||
| "Version": "2012-10-17", | ||
| "Statement": [ | ||
| { | ||
| "Effect": "Allow", | ||
| "Principal": { | ||
| "Service": "eks.amazonaws.com" | ||
| }, | ||
| "Action": "sts:AssumeRole" | ||
| } | ||
| ] | ||
| }) | ||
| } | ||
|
|
||
| resource "aws_iam_role_policy_attachment" "AmazonEKSClusterPolicy" { | ||
| policy_arn = "arn:aws:iam::aws:policy/AmazonEKSClusterPolicy" | ||
| role = aws_iam_role.eks-iam-role.name | ||
| } | ||
|
|
||
| resource "aws_iam_role_policy_attachment" "AmazonEC2ContainerRegistryReadOnly-EKS" { | ||
| policy_arn = "arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly" | ||
| role = aws_iam_role.eks-iam-role.name | ||
| } | ||
|
|
||
| resource "aws_iam_role_policy_attachment" "AmazonEKSWorkerNodePolicy" { | ||
| policy_arn = "arn:aws:iam::aws:policy/AmazonEKSWorkerNodePolicy" | ||
| role = aws_iam_role.workernodes.name | ||
| } | ||
|
|
||
| resource "aws_iam_role_policy_attachment" "AmazonEKS_CNI_Policy" { | ||
| policy_arn = "arn:aws:iam::aws:policy/AmazonEKS_CNI_Policy" | ||
| role = aws_iam_role.workernodes.name | ||
| } | ||
|
|
||
| resource "aws_iam_role_policy_attachment" "EC2InstanceProfileForImageBuilderECRContainerBuilds" { | ||
| policy_arn = "arn:aws:iam::aws:policy/EC2InstanceProfileForImageBuilderECRContainerBuilds" | ||
| role = aws_iam_role.workernodes.name | ||
| } | ||
|
|
||
| resource "aws_iam_role_policy_attachment" "AmazonEC2ContainerRegistryReadOnly" { | ||
| policy_arn = "arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly" | ||
| role = aws_iam_role.workernodes.name | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if i change the name of my subnet
Is the syntax correct?
Please refer to the documentation i shared earlier