Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
e678a50
CircleCI Commit
yanchoys Oct 30, 2023
a62a49a
Update config.yml
yanchoys Oct 30, 2023
060d8f0
Update config.yml
yanchoys Oct 30, 2023
9d735fe
Update config.yml
yanchoys Oct 30, 2023
6c2f442
Update config.yml
yanchoys Oct 30, 2023
c2999f9
Update config.yml
yanchoys Oct 30, 2023
ae4624a
Update config.yml
yanchoys Oct 30, 2023
fb2749f
Update config.yml
yanchoys Oct 30, 2023
3f2bdf6
Update config.yml
yanchoys Oct 30, 2023
35f9c5c
Update config.yml
yanchoys Oct 30, 2023
6d62573
Update config.yml
yanchoys Oct 30, 2023
85565ef
Update config.yml
yanchoys Oct 30, 2023
03bfdb1
Update config.yml
yanchoys Oct 30, 2023
5de6924
Update config.yml
yanchoys Oct 30, 2023
9b37dc0
Update config.yml
yanchoys Oct 30, 2023
0979886
Update config.yml
yanchoys Oct 30, 2023
bb406b5
Update config.yml
yanchoys Oct 30, 2023
016fc08
Update config.yml
yanchoys Oct 30, 2023
53fc828
Update config.yml
yanchoys Oct 30, 2023
866a053
Update config.yml
yanchoys Oct 30, 2023
012ffcd
Update config.yml
yanchoys Oct 30, 2023
aa56218
Update config.yml
yanchoys Oct 30, 2023
2aac831
Update config.yml
yanchoys Oct 30, 2023
b17fa0a
Update config.yml
yanchoys Oct 30, 2023
1ba3b2b
Update config.yml
yanchoys Oct 30, 2023
0a1bc9f
Update config.yml
yanchoys Oct 30, 2023
f0ba37a
Update config.yml
yanchoys Oct 30, 2023
20ed59d
Update config.yml
yanchoys Oct 30, 2023
7805cdb
Update config.yml
yanchoys Oct 30, 2023
25eb7a8
Update config.yml
yanchoys Oct 30, 2023
d5014b3
Update config.yml
yanchoys Oct 30, 2023
523a34d
Update config.yml
yanchoys Oct 31, 2023
9847b8d
Update config.yml
yanchoys Oct 31, 2023
78ace44
Update config.yml
yanchoys Oct 31, 2023
b21622a
Update config.yml
yanchoys Oct 31, 2023
898dbed
Update config.yml
yanchoys Oct 31, 2023
a8e1b93
Update config.yml
yanchoys Oct 31, 2023
f840e33
Update config.yml
yanchoys Oct 31, 2023
1e6f07e
Update config.yml
yanchoys Oct 31, 2023
9dda6cc
Update config.yml
yanchoys Oct 31, 2023
12639e5
Update config.yml
yanchoys Oct 31, 2023
854e701
Update config.yml
yanchoys Oct 31, 2023
4f69c3f
Update config.yml
yanchoys Oct 31, 2023
0ef0366
Update config.yml
yanchoys Oct 31, 2023
5aae350
Update config.yml
yanchoys Oct 31, 2023
7fc2900
Update config.yml
yanchoys Oct 31, 2023
7cceb25
Update config.yml
yanchoys Oct 31, 2023
0598e58
Update config.yml
yanchoys Oct 31, 2023
712c4f6
Update config.yml
yanchoys Oct 31, 2023
3be2bb0
Update config.yml
yanchoys Oct 31, 2023
60d6a1f
Update config.yml
yanchoys Oct 31, 2023
11dbca0
Update config.yml
yanchoys Oct 31, 2023
918b24b
Update config.yml
yanchoys Oct 31, 2023
94dfe99
Update config.yml
yanchoys Oct 31, 2023
430489f
Update config.yml
yanchoys Oct 31, 2023
1b43587
Update config.yml
yanchoys Oct 31, 2023
ab5c62b
Update config.yml
yanchoys Oct 31, 2023
fdcbce5
Update main.tf
yanchoys Oct 31, 2023
f2407a4
Update main.tf
yanchoys Oct 31, 2023
e14498d
Update main.tf
yanchoys Oct 31, 2023
9da341d
Update config.yml
yanchoys Oct 31, 2023
bcd7513
Update main.tf
yanchoys Oct 31, 2023
3007766
Update config.yml
yanchoys Oct 31, 2023
0f8d0a7
Update main.tf
yanchoys Oct 31, 2023
263e63a
Update main.tf
yanchoys Oct 31, 2023
834d39c
Update main.tf
yanchoys Oct 31, 2023
e92ea28
Update config.yml
yanchoys Oct 31, 2023
45fedc4
Update config.yml
yanchoys Oct 31, 2023
e782508
Update config.yml
yanchoys Oct 31, 2023
20446de
Update config.yml
yanchoys Oct 31, 2023
792fcc6
Update config.yml
yanchoys Oct 31, 2023
d2c8f90
Update config.yml
yanchoys Oct 31, 2023
f0fcc69
Update config.yml
yanchoys Oct 31, 2023
5b5e8ea
Update config.yml
yanchoys Oct 31, 2023
b10c27a
Update config.yml
yanchoys Oct 31, 2023
d7a232c
Update config.yml
yanchoys Oct 31, 2023
f8a16f8
Update config.yml
yanchoys Oct 31, 2023
0fda454
Update config.yml
yanchoys Oct 31, 2023
45b140a
Update config.yml
yanchoys Oct 31, 2023
4afb502
Update config.yml
yanchoys Oct 31, 2023
6d32691
Update config.yml
yanchoys Oct 31, 2023
262b30a
Update config.yml
yanchoys Oct 31, 2023
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
166 changes: 166 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
version: 2.1

executors:
tfsec-executor:
docker:
- image: aquasec/tfsec:latest
environment:
TF_SEC_DIR: /tmp/project
working_directory: /tmp/project

terraform-executor:
docker:
- image: hashicorp/terraform:latest
working_directory: /tmp/project

aws-executor:
docker:
- image: amazon/aws-cli:latest
working_directory: /tmp/project

git-executor:
docker:
- image: circleci/python:3.7.9 # A basic image that includes git
working_directory: /tmp/project

jobs:
tfsec-test:
executor: tfsec-executor
steps:
- checkout
- run:
name: Run tfsec tests
command: tfsec .

# terraform-init:
# executor: terraform-executor
# steps:
# - checkout
# - run:
# name: Terraform init
# command: |
# cd infrastructure
# terraform init

terraform-validate-plan:
executor: terraform-executor
steps:
- checkout
- run:
name: Terraform validate and plan
command: |
cd infrastructure
terraform init
terraform validate
terraform plan

hold-for-approval-1:
executor: tfsec-executor
steps:
- checkout
- run:
name: Hold for approval
command: echo "Hold for approval. Approve in CircleCI dashboard to continue."

terraform-apply:
executor: terraform-executor
steps:
- checkout
- run:
name: Terraform apply
command: echo "terraform apply -auto-approve"

infrastructure-tests:
executor: aws-executor
steps:
- checkout
- run:
name: Check EC2 instances
command: |
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
aws configure set region us-east-1
aws ec2 describe-instances --query "Reservations[*].Instances[*].{ID:InstanceId}" --output text
- run:
name: Check RDS database
command: |
aws rds describe-db-instances --query "DBInstances[*].DBInstanceIdentifier" --output text
- run:
name: Check VPC and subnets
command: |
aws ec2 describe-vpcs --query "Vpcs[*].{ID:VpcId}" --output text
echo "AWS CLI commands completed"
# aws ec2 describe-subnets --query "Subnets[*].{ID:SubnetId}" --output text


- run:
name: Check database accessibility
command: |
# aws rds describe-db-instances --db-instance-identifier YOUR_DB_INSTANCE_ID --query "DBInstances[*].VpcSecurityGroups[0].VpcSecurityGroupId" --output text
# aws ec2 describe-security-groups --group-ids YOUR_SECURITY_GROUP_ID --query "SecurityGroups[*].{Ingress:IpPermissions}" --output text



hold-for-approval-2:
executor: tfsec-executor
steps:
- checkout
- run:
name: Hold for approval
command: echo "Hold for approval. Approve in CircleCI dashboard to continue."

terraform-destroy:
executor: terraform-executor
steps:
- checkout
- run:
name: Terraform destroy
command: |
cd infrastructure
echo "terraform destroy -auto-approve"

git-pull:
executor: git-executor
steps:
- checkout
- run:
name: Setup Git Configuration
command: |
git config user.name "illia"
git config user.email "llolik7262@gmail.com"
- run:
name: Create and Submit Pull Request
command: |
# git checkout -b my-new-changes
# git add .
# git commit -m "Describe your changes"
# git push origin circleci-project-setup
gh pr create --base main --head circleci-project-setup


workflows:
version: 2
build-deploy:
jobs:
- tfsec-test
#- terraform-init
- terraform-validate-plan
# requires:
# - terraform-init
#- hold-for-approval-1:
# type: approval
- terraform-apply:
requires:
- terraform-validate-plan
#- hold-for-approval-1
- infrastructure-tests:
requires:
- terraform-apply
#- hold-for-approval-2:
# type: approval
- terraform-destroy:
requires:
- infrastructure-tests
- git-pull:
requires:
- terraform-destroy
5 changes: 3 additions & 2 deletions infrastructure/main.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
provider "aws" {
profile = "default"
region = "eu-central-1"
region = "us-east-1"
access_key = "AKIATVQLTGK5WBSP2G5C"
secret_key = "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"
}