Skip to content

Commit 118b4c9

Browse files
committed
init commit
1 parent e2bc2e0 commit 118b4c9

File tree

21 files changed

+9906
-28662
lines changed

21 files changed

+9906
-28662
lines changed

.gitignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,37 @@
2121
npm-debug.log*
2222
yarn-debug.log*
2323
yarn-error.log*
24+
# Local .terraform directories
25+
**/.terraform/*
26+
27+
# .tfstate files
28+
*.tfstate
29+
*.tfstate.*
30+
31+
# Crash log files
32+
crash.log
33+
crash.*.log
34+
35+
# Exclude all .tfvars files, which are likely to contain sensitive data, such as
36+
# password, private keys, and other secrets. These should not be part of version
37+
# control as they are data points which are potentially sensitive and subject
38+
# to change depending on the environment.
39+
*.tfvars
40+
*.tfvars.json
41+
42+
# Ignore override files as they are usually used to override resources locally and so
43+
# are not checked in
44+
override.tf
45+
override.tf.json
46+
*_override.tf
47+
*_override.tf.json
48+
49+
# Include override files you do wish to add to version control using negated pattern
50+
# !example_override.tf
51+
52+
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
53+
# example: *tfplan*
54+
55+
# Ignore CLI configuration files
56+
.terraformrc
57+
terraform.rc

README.md

Lines changed: 22 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,31 @@
1-
# Getting Started with Create React App
1+
# Terraform CRA AWS Infrastructure
22

3-
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
3+
[Blog post](https://www.eunchurn.com/blog/development/2022-10-23-tWIL)
4+
## Prerequisite
45

5-
## Available Scripts
6+
- NodeJS 16
7+
- [Terraform](https://learn.hashicorp.com/tutorials/terraform/install-cli)
68

7-
In the project directory, you can run:
9+
### Project
810

9-
### `npm start`
11+
- Create React App
12+
- `npx create-react-app terraform-react-s3-cloudfront-pipeline --template=typescript`
13+
- Change your App name `terraform/main.tf`
14+
- `application_name = "{your app name}"`
15+
- `environment = "{app environment name}"`
16+
- Change your repository info `terraform/main.tf`
17+
- `repository_name = "{your repository}"`
18+
- `branch_name = "{your deploy branch}"`
19+
- Change your domain `terraform/main.tf`
20+
- `certificate_domain_name = "{your ACM name}"` should be `us-east-1` region
21+
- `cloudfront_domain_name = "{your Domain name}"`
1022

11-
Runs the app in the development mode.\
12-
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
23+
## Usage
1324

14-
The page will reload if you make edits.\
15-
You will also see any lint errors in the console.
25+
- `cd terraform`
26+
- `terraform init`
27+
- `terraform apply`
1628

17-
### `npm test`
29+
- Check outputs
1830

19-
Launches the test runner in the interactive watch mode.\
20-
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
2131

22-
### `npm run build`
23-
24-
Builds the app for production to the `build` folder.\
25-
It correctly bundles React in production mode and optimizes the build for the best performance.
26-
27-
The build is minified and the filenames include the hashes.\
28-
Your app is ready to be deployed!
29-
30-
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
31-
32-
### `npm run eject`
33-
34-
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
35-
36-
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
37-
38-
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
39-
40-
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
41-
42-
## Learn More
43-
44-
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45-
46-
To learn React, check out the [React documentation](https://reactjs.org/).

buildspec.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
version: 0.2
2+
phases:
3+
install:
4+
runtime-versions:
5+
nodejs: 16
6+
pre_build:
7+
commands:
8+
- echo "Installing dependancies..."
9+
- yarn
10+
build:
11+
commands:
12+
- echo "Executing ${ENV} environment"
13+
- echo "Run application tests"
14+
- CI=true npm test
15+
- echo Build started on `date`
16+
- yarn build
17+
post_build:
18+
commands:
19+
- echo "Copy the contents of build to destination S3 bucket"
20+
- aws s3 cp --recursive --acl public-read ./build s3://$S3_BUCKET_DESTINATION/
21+
artifacts:
22+
files:
23+
- "**/*"
24+
cache:
25+
paths:
26+
- "node_modules/**/*"
27+
- "/root/.yarn-cache/**/*"

0 commit comments

Comments
 (0)