Skip to content

Commit

Permalink
Reword extra to vpc
Browse files Browse the repository at this point in the history
  • Loading branch information
iuriaranda committed Nov 6, 2024
1 parent 410c815 commit 9ba2635
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ terraform apply -var="installation_name=test" -var="management_cluster_oidc_prov
```
export INSTALLATION_NAME=test
export MANAGEMENT_CLUSTER_OIDC_PROVIDER_DOMAIN=irsa.test.gaws.gigantic.io
# Optional: only set to true if this installation is going to be used exclusively to create WCs on existing infrastructure
# Optional: only set to true if this installation is going to be used exclusively to create WCs on existing VPCs and subnets
# export BYOVPC=true
chmod +x setup.sh
./setup.sh
Expand Down
2 changes: 1 addition & 1 deletion capa-controller-role/cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ NC='\033[0m'
ROLE_NAME="giantswarm-${INSTALLATION_NAME}-capa-controller"
AWS_ACCOUNT_ID="$(aws sts get-caller-identity --output text --query 'Account')"

POL_TYPES=("capa-controller" "capa-controller-extra" "dns-controller" "eks-controller" "iam-controller" "irsa-operator" "resolver-rules-operator" "network-topology-operator" "mc-bootstrap" "crossplane")
POL_TYPES=("capa-controller" "capa-controller-vpc" "dns-controller" "eks-controller" "iam-controller" "irsa-operator" "resolver-rules-operator" "network-topology-operator" "mc-bootstrap" "crossplane")
POL_ARN_PREFIX="arn:aws:iam::${AWS_ACCOUNT_ID}:policy"

function echo_fail_or_success {
Expand Down
8 changes: 4 additions & 4 deletions capa-controller-role/cloud-formation-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ Parameters:
Default: false

Conditions:
# The extra policy is not needed in BYO VPC installations
CreateExtraPolicy: !Not
# The policy is not needed in BYO VPC installations
CreateVpcPolicy: !Not
- !Ref ByoVpc

Resources:
Expand Down Expand Up @@ -194,10 +194,10 @@ Resources:
- !Ref GiantSwarmCapaControllerRole

GiantSwarmCapaControllerPolicyExtra:
Condition: CreateExtraPolicy
Condition: CreateVpcPolicy
Type: "AWS::IAM::Policy"
Properties:
PolicyName: !Sub "giantswarm-${InstallationName}-capa-controller-policy-extra"
PolicyName: !Sub "giantswarm-${InstallationName}-capa-controller-policy-vpc"
PolicyDocument:
Version: "2012-10-17"
Statement:
Expand Down
14 changes: 7 additions & 7 deletions capa-controller-role/giantswarm-capa-role.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ resource "aws_iam_role_policy_attachment" "giantswarm-capa-controller-policy-att
policy_arn = aws_iam_policy.giantswarm-capa-controller-policy.arn
}

resource "aws_iam_policy" "giantswarm-capa-controller-policy-extra" {
count = var.byovpc ? 0 : 1 # This extra policy is not needed in BYO VPC installations
name = "giantswarm-${var.installation_name}-capa-controller-policy-extra"
policy = file("${path.module}/capa-controller-policy-extra.json")
resource "aws_iam_policy" "giantswarm-capa-controller-policy-vpc" {
count = var.byovpc ? 0 : 1 # This policy is not needed in BYO VPC installations
name = "giantswarm-${var.installation_name}-capa-controller-policy-vpc"
policy = file("${path.module}/capa-controller-policy-vpc.json")
tags = local.tags
}
resource "aws_iam_role_policy_attachment" "giantswarm-capa-controller-policy-extra-attachment" {
count = var.byovpc ? 0 : 1 # This extra policy is not needed in BYO VPC installations
resource "aws_iam_role_policy_attachment" "giantswarm-capa-controller-policy-vpc-attachment" {
count = var.byovpc ? 0 : 1 # This policy is not needed in BYO VPC installations
role = aws_iam_role.giantswarm-capa-controller-role.name
policy_arn = aws_iam_policy.giantswarm-capa-controller-policy-extra.arn
policy_arn = aws_iam_policy.giantswarm-capa-controller-policy-vpc.arn
}

resource "aws_iam_policy" "giantswarm-dns-controller-policy" {
Expand Down
4 changes: 2 additions & 2 deletions capa-controller-role/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ TAGS="Key=installation,Value=${INSTALLATION_NAME}"
BYOVPC=${BYOVPC:-false}

if [ "$BYOVPC" == "false" ]; then
# This extra policy is not needed in BYO VPC installations
POL_TYPES+=("capa-controller-extra")
# This policy is not needed in BYO VPC installations
POL_TYPES+=("capa-controller-vpc")
fi

function echo_fail_or_success {
Expand Down

0 comments on commit 9ba2635

Please sign in to comment.