Skip to content

Commit

Permalink
update: ACK and Crossplane labs now reconfigure app the same as other…
Browse files Browse the repository at this point in the history
… labs
  • Loading branch information
niallthomson committed Oct 11, 2024
1 parent 9f4a5ff commit feb87ce
Show file tree
Hide file tree
Showing 56 changed files with 295 additions and 788 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@

logmessage "Deleting resources created by ACK..."

eksctl delete iamserviceaccount --name carts-ack --namespace carts --cluster $EKS_CLUSTER_NAME -v 0
delete-all-if-crd-exists tables.dynamodb.services.k8s.aws
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,22 @@ module "dynamodb_ack_addon" {
tags = var.tags
}

module "iam_assumable_role_carts" {
source = "terraform-aws-modules/iam/aws//modules/iam-assumable-role-with-oidc"
version = "5.44.0"
create_role = true
role_name = "${var.addon_context.eks_cluster_id}-carts-ack"
provider_url = var.addon_context.eks_oidc_issuer_url
role_policy_arns = [aws_iam_policy.carts_dynamo.arn]
oidc_fully_qualified_subjects = ["system:serviceaccount:carts:carts"]

tags = var.tags
}

resource "aws_iam_policy" "carts_dynamo" {
name = "${var.addon_context.eks_cluster_id}-carts-dynamo"
path = "/"
description = "DynamoDB policy for AWS Sample Carts Application"
description = "Dynamo policy for carts application"

policy = <<EOF
{
Expand All @@ -57,7 +69,8 @@ resource "aws_iam_policy" "carts_dynamo" {
"Effect": "Allow",
"Action": "dynamodb:*",
"Resource": [
"arn:aws:dynamodb:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:*"
"arn:aws:dynamodb:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:table/${var.addon_context.eks_cluster_id}-carts-ack",
"arn:aws:dynamodb:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:table/${var.addon_context.eks_cluster_id}-carts-ack/index/*"
]
}
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
output "environment_variables" {
description = "Environment variables to be added to the IDE shell"
value = {
DYNAMODB_POLICY_ARN = aws_iam_policy.carts_dynamo.arn
CARTS_IAM_ROLE = module.iam_assumable_role_carts.iam_role_arn
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: carts
namespace: carts
annotations:
eks.amazonaws.com/role-arn: ${CARTS_IAM_ROLE}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CARTS_DYNAMODB_TABLENAME=${EKS_CLUSTER_NAME}-carts-ack
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../../../../base-application/carts
patches:
- path: carts-serviceAccount.yaml
configMapGenerator:
- name: carts
namespace: carts
env: config.properties
behavior: replace
options:
disableNameSuffixHash: true

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../../../../base-application/carts
- dynamodb-ack-configmap.yaml
- dynamodb-create.yaml
patches:
- path: deployment.yaml

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit feb87ce

Please sign in to comment.