Skip to content

Commit

Permalink
Merge pull request #17 from sumanmanna134/phase2_aws
Browse files Browse the repository at this point in the history
CICD
  • Loading branch information
sumanmanna134 authored Sep 20, 2024
2 parents ae111f0 + da5772f commit 3207194
Show file tree
Hide file tree
Showing 12 changed files with 100 additions and 19 deletions.
6 changes: 3 additions & 3 deletions aws/azvar.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ variable "HOME" {
type = string

}
variable "token" {
type = string
# variable "token" {
# type = string

}
# }

variable "bucket_name" {
type = string
Expand Down
6 changes: 3 additions & 3 deletions aws/data.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
data "vault_generic_secret" "phone_number" {
path = "secret/apps"
# data "vault_generic_secret" "phone_number" {
# path = "secret/apps"

}
# }

data "aws_s3_bucket" "data_bucket" {
depends_on = [module.s3]
Expand Down
Binary file added aws/infra.plan
Binary file not shown.
Binary file modified aws/infra.tfplan
Binary file not shown.
37 changes: 33 additions & 4 deletions aws/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ terraform {
dynamodb_table = "tf-lock"
encrypt = true
}
# backend "remote" {
# hostname = "app.terraform.io"
# organization = "hilledge"
# workspaces {
# name = "multi-cloud"
# }

# }

required_providers {
aws = {
Expand Down Expand Up @@ -44,17 +52,38 @@ module "aws_key_pair" {

}

module "vault" {
source = "../modules/vault"
vault_token = var.token
# module "vault" {
# source = "../modules/vault"
# vault_token = var.token

}
# }

module "s3" {
source = "../modules/aws-modules/s3"
bucket_name = var.bucket_name
}

resource "aws_iam_policy" "iam_policy" {
name = "data_bucket_policy"
description = "Allow Access To Bucket"
policy = jsonencode({
"Version" : "2012-10-17",
"Statement" : [
{
"Effect" : "Allow",
"Action" : [
"s3:Get*",
"s3:List*"
],
"Resource" : "${data.aws_s3_bucket.data_bucket.arn}"
}
]
})



}




Expand Down
8 changes: 4 additions & 4 deletions aws/output.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ output "aws_key_output_private_ip" {

}

output "phone_number" {
value = data.vault_generic_secret.phone_number
sensitive = true
# output "phone_number" {
# value = data.vault_generic_secret.phone_number
# sensitive = true

}
# }
21 changes: 21 additions & 0 deletions azure/azvar.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ variable "storage_account_name" {

variable "tags" {
type = map(string)
default = {
"environment" = "dev"
}

}

Expand All @@ -37,4 +40,22 @@ variable "container_name" {
type = string

}
variable "subscription_id" {

}
variable "client_id" {

}
variable "client_secret" {

}
variable "tenant_id" {

}

variable "GITHUB_TOKEN" {

}



Binary file added azure/infra.plan
Binary file not shown.
24 changes: 23 additions & 1 deletion azure/provider.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,36 @@
terraform {

backend "remote" {
hostname = "app.terraform.io"
organization = "azure_website_gh_action"
workspaces {
name = "azure_website_gh_action"
}

}
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "3.113.0"
}

github = {
source = "integrations/github"
version = "5.25.0"
}
}

}

provider "azurerm" {
skip_provider_registration = true
subscription_id = var.subscription_id
tenant_id = var.tenant_id
client_id = var.client_id
client_secret = var.client_secret
features {}
}

provider "github" {
token = var.GITHUB_TOKEN

}
5 changes: 1 addition & 4 deletions azure/tfvars/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,4 @@ location = "Central India"
storage_account_name = "storageaccount2021213"
subet_name = "azsubnet"
vent_name = "vnetaz105"
container_name = "container20241"
tags = {
"environment" = "dev"
}
container_name = "container20241"
1 change: 1 addition & 0 deletions modules/aws-modules/ec2/createinstance.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

11 changes: 11 additions & 0 deletions scripts/installnginx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
until [[ -f /var/lib/cloud/instance/boot-finished ]]; do
sleep 1
done


#install nginx
apt-get update
apt-get -y install nginx

service nginx start

0 comments on commit 3207194

Please sign in to comment.