From 7b6a5d062fdecc8e7ef58fb4731eba3c898f0856 Mon Sep 17 00:00:00 2001 From: Shadi38 <113238379+Shadi38@users.noreply.github.com> Date: Tue, 5 Mar 2024 21:20:52 +0000 Subject: [PATCH] added teraform --- .github/workflows/front-end.yml | 10 - .gitignore | 38 +++- client/.gitignore | 40 +++- client/src/App.js | 26 ++- client/src/Videos.js | 342 ++++++++--------------------- infrastructure/.terraform.lock.hcl | 24 ++ infrastructure/mainS3Ec2Rds.tf | 99 +++++++++ infrastructure/s3/bucket.tf | 25 +++ infrastructure/s3/var.tf | 5 + infrastructure/variable.tf | 14 ++ server/package.json | 6 +- server/server.js | 65 +++--- 12 files changed, 384 insertions(+), 310 deletions(-) create mode 100644 infrastructure/.terraform.lock.hcl create mode 100644 infrastructure/mainS3Ec2Rds.tf create mode 100644 infrastructure/s3/bucket.tf create mode 100644 infrastructure/s3/var.tf create mode 100644 infrastructure/variable.tf diff --git a/.github/workflows/front-end.yml b/.github/workflows/front-end.yml index 5c06625410..b87fa10112 100644 --- a/.github/workflows/front-end.yml +++ b/.github/workflows/front-end.yml @@ -30,13 +30,3 @@ jobs: aws-region: eu-north-1 - name: Deploy static site to S3 bucket run: 'aws s3 sync ./client/build s3://fullstackprojectaws' -<<<<<<< HEAD -======= - - - - - - - ->>>>>>> 1d0f65ee (creating yml file) diff --git a/.gitignore b/.gitignore index 6a6fdbc041..51c664feba 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,39 @@ node_modules -.env \ No newline at end of file +.env + +# Local .terraform directories + +**/.terraform/*/* + +# .tfstate files +*.tfstate +*.tfstate.* + +# Crash log files +crash.log +crash.*.log + +# Exclude all .tfvars files, which are likely to contain sensitive data, such as +# password, private keys, and other secrets. These should not be part of version +# control as they are data points which are potentially sensitive and subject +# to change depending on the environment. +*.tfvars +*.tfvars.json + +# Ignore override files as they are usually used to override resources locally and so +# are not checked in +override.tf +override.tf.json +*_override.tf +*_override.tf.json + +# Include override files you do wish to add to version control using negated pattern +# !example_override.tf + +# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan +# example: *tfplan* + +# Ignore CLI configuration files +.terraformrc +terraform.rc \ No newline at end of file diff --git a/client/.gitignore b/client/.gitignore index b512c09d47..51c664feba 100644 --- a/client/.gitignore +++ b/client/.gitignore @@ -1 +1,39 @@ -node_modules \ No newline at end of file + +node_modules +.env + +# Local .terraform directories + +**/.terraform/*/* + +# .tfstate files +*.tfstate +*.tfstate.* + +# Crash log files +crash.log +crash.*.log + +# Exclude all .tfvars files, which are likely to contain sensitive data, such as +# password, private keys, and other secrets. These should not be part of version +# control as they are data points which are potentially sensitive and subject +# to change depending on the environment. +*.tfvars +*.tfvars.json + +# Ignore override files as they are usually used to override resources locally and so +# are not checked in +override.tf +override.tf.json +*_override.tf +*_override.tf.json + +# Include override files you do wish to add to version control using negated pattern +# !example_override.tf + +# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan +# example: *tfplan* + +# Ignore CLI configuration files +.terraformrc +terraform.rc \ No newline at end of file diff --git a/client/src/App.js b/client/src/App.js index b9c3f82ad4..fbf66c5426 100644 --- a/client/src/App.js +++ b/client/src/App.js @@ -1,20 +1,19 @@ -import React, {useState,useEffect } from "react"; -import { BrowserRouter as Router, Route, Routes, Link } from "react-router-dom"; +import React, { useState, useEffect } from "react"; +import { BrowserRouter as Router, Route, Routes, Link } from "react-router-dom"; import "./App.css"; import Videos from "./Videos.js"; function App() { - const [showVideos, setShowVideos] = useState(false); const [loadVideo, setLoadVideo] = useState([]); - const [order,setOrder]=useState("ase"); + const [order, setOrder] = useState("ase"); useEffect(() => { const getData = async () => { try { const response = await fetch( - "http://ec2-16-171-32-223.eu-north-1.compute.amazonaws.com:3000/videos" + "http://ec2-13-49-244-227.eu-north-1.compute.amazonaws.com:3000/videos" ); if (!response.ok) { throw new Error("something went wrong"); @@ -30,7 +29,6 @@ function App() { getData(); }, []); - function orderClickHandler(e, newOrder) { e.preventDefault(); @@ -56,9 +54,19 @@ function App() {