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

Added terraform modules to create S3 bucket and dynamodb table as per assignment #34

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions create_dynamodb/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
provider "aws" {
region = var.region
}

resource "aws_dynamodb_table" "table" {
name = var.name
billing_mode = var.billing_mode
read_capacity = var.read_capacity
write_capacity = var.write_capacity
hash_key = "LockID"

attribute {
name = "LockID"
type = "S"
}
tags = var.tags
}
9 changes: 9 additions & 0 deletions create_dynamodb/output.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
output "table_name" {
description = "The name of the DynamoDB table"
value = aws_dynamodb_table.table.name
}

output "table_arn" {
description = "The ARN of the DynamoDB table"
value = aws_dynamodb_table.table.arn
}
32 changes: 32 additions & 0 deletions create_dynamodb/vars.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
variable "region" {
type = string
description = "region of dynamodb table"
default = ""
}
variable "name" {
type = string
description = "name of dynamodb table"
default = ""
}
variable "billing_mode" {
description = "Controls how you are charged for read and write throughput and how you manage capacity"
type = string
default = "PROVISIONED"
}

variable "read_capacity" {
description = "The number of read units for this table"
type = number
default = 5
}

variable "write_capacity" {
description = "The number of write units for this table"
type = number
default = 5
}
variable "tags" {
description = "A mapping of tags to assign to the table"
type = map(string)
default = {}
}
13 changes: 13 additions & 0 deletions create_s3/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
provider "aws" {
region = var.region
}
resource "aws_s3_bucket" "this" {
bucket_prefix = var.bucket_prefix
tags = var.tags
}
resource "aws_s3_bucket_versioning" "this" {
bucket = aws_s3_bucket.this.id
versioning_configuration {
status = "Enabled"
}
}
12 changes: 12 additions & 0 deletions create_s3/output.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
output "bucket_region" {
description = "The region of the bucket"
value = aws_s3_bucket.this.region
}
output "bucket_name" {
description = "The name of the bucket"
value = aws_s3_bucket.this.bucket_prefix
}
output "bucket_arn" {
description = "The ARN of the bucket"
value = aws_s3_bucket.this.arn
}
16 changes: 16 additions & 0 deletions create_s3/vars.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
variable "region" {
description = "Region to create s3_bucket"
type = string
default = ""
}

variable "bucket_prefix" {
description = "Prefix of the bucket name to create"
type = string
default = ""
}
variable "tags" {
description = "A mapping of tags to assign to the bucket"
type = map(string)
default = {}
}
19 changes: 19 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
provider "aws" {
region = "ap-south-1"
}
module "s3_bucket" {
source = "./create_s3"
bucket_prefix = "assign4a-581"
tags = {
Environment = "test"
Owner = "QA team"
}
}
module "dynamodb" {
source = "./create_dynamodb"
name = "assign4b-581"
tags = {
Name = "assign4b"
Environment = "QA"
}
}
9 changes: 0 additions & 9 deletions modules/create_ec2/ec2.tf

This file was deleted.

7 changes: 0 additions & 7 deletions modules/create_ec2/outputs.tf

This file was deleted.

19 changes: 0 additions & 19 deletions modules/create_ec2/vars.tf

This file was deleted.

1 change: 0 additions & 1 deletion modules/create_k8s/keys/README.md

This file was deleted.

165 changes: 0 additions & 165 deletions modules/create_k8s/main.tf

This file was deleted.

26 changes: 0 additions & 26 deletions modules/create_k8s/scripts/k8s-components-install.sh

This file was deleted.

8 changes: 0 additions & 8 deletions modules/create_k8s/scripts/k8s-kubeconfig-cni.sh

This file was deleted.

24 changes: 0 additions & 24 deletions modules/create_k8s/vars.tf

This file was deleted.

Loading