File tree Expand file tree Collapse file tree 3 files changed +26
-49
lines changed
buildspecs/awsome-fastapi Expand file tree Collapse file tree 3 files changed +26
-49
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,11 @@ resource "aws_iam_role_policy_attachment" "eks_vpc_policy" {
4242 policy_arn = " arn:aws:iam::aws:policy/AmazonEKSVPCResourceController"
4343}
4444
45+ resource "aws_iam_role_policy_attachment" "eks_ec2_policy" {
46+ role = aws_iam_role. eks_cluster_role . name
47+ policy_arn = " arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly"
48+ }
49+
4550# Create Node Group IAM Role
4651resource "aws_iam_role" "eks_node_role" {
4752 name = " ${ var . cluster_name } -eks-node-role"
Original file line number Diff line number Diff line change @@ -46,45 +46,19 @@ phases:
4646 - name: $IMAGE_REPO_NAME
4747 image: $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:latest
4848 ports:
49- - containerPort: 80
50- ---
51- apiVersion: v1
52- kind: Service
53- metadata:
54- name: $IMAGE_REPO_NAME-service
55- namespace: default
56- labels:
57- app: $IMAGE_REPO_NAME
58- spec:
59- selector:
60- app: $IMAGE_REPO_NAME
61- ports:
62- - protocol: TCP
63- port: 80
64- targetPort: 80
65- type: ClusterIP # Changed from LoadBalancer since we'll use an Ingress
66- ---
67- apiVersion: networking.k8s.io/v1
68- kind: Ingress
69- metadata:
70- name: $IMAGE_REPO_NAME-ingress
71- annotations:
72- kubernetes.io/ingress.class: alb
73- alb.ingress.kubernetes.io/scheme: internet-facing
74- alb.ingress.kubernetes.io/target-type: ip
75- alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS":443}]'
76- alb.ingress.kubernetes.io/ssl-redirect: '443'
77- spec:
78- rules:
79- - http:
80- paths:
81- - path: /
82- pathType: Prefix
83- backend:
84- service:
85- name: $IMAGE_REPO_NAME-service
86- port:
87- number: 80
49+ - containerPort: 8080
50+ livenessProbe:
51+ httpGet:
52+ path: /
53+ port: 80
54+ initialDelaySeconds: 10
55+ periodSeconds: 5
56+ readinessProbe:
57+ httpGet:
58+ path: /
59+ port: 80
60+ initialDelaySeconds: 10
61+ periodSeconds: 5
8862 EOF
8963artifacts :
9064 files :
Original file line number Diff line number Diff line change @@ -178,8 +178,9 @@ resource "aws_iam_role_policy_attachment" "eks_buildprj_attach_role" {
178178
179179# Pipeline
180180resource "aws_codepipeline" "pipeline" {
181- name = var. repo_name
182- role_arn = aws_iam_role. pipeline_role . arn
181+ name = var. repo_name
182+ role_arn = aws_iam_role. pipeline_role . arn
183+ pipeline_type = " V2"
183184
184185 artifact_store {
185186 type = " S3"
@@ -226,8 +227,8 @@ resource "aws_codepipeline" "pipeline" {
226227 }
227228
228229 # Static Analysis Stage
229- /* stage {
230- name = "StaticAnalysis "
230+ stage {
231+ name = " Test "
231232
232233 action {
233234 name = " StaticCodeAnalysis"
@@ -241,11 +242,6 @@ resource "aws_codepipeline" "pipeline" {
241242 ProjectName = aws_codebuild_project.static_analysis_project.name
242243 }
243244 }
244- }
245-
246- # Open Source Scanning Stage
247- stage {
248- name = "OSSSecurityScan"
249245
250246 action {
251247 name = " OSSDependencyScan"
@@ -259,7 +255,9 @@ resource "aws_codepipeline" "pipeline" {
259255 ProjectName = aws_codebuild_project.oss_scanning_project.name
260256 }
261257 }
262- }*/
258+ }
259+
260+ # Open Source Scanning Stage
263261
264262 stage {
265263 name = " Deploy"
You can’t perform that action at this time.
0 commit comments