Fixup: ECR does not have the --tag-specifications. Used ecr tag-resource instead

This commit is contained in:
JustFiesta 2024-05-21 13:35:13 +02:00
parent e4a122831c
commit b242de2d39

View file

@ -69,7 +69,6 @@ echo "Creating Elastic Container Registry (ECR)..."
ECR_REPO_JSON=$(aws ecr create-repository \ ECR_REPO_JSON=$(aws ecr create-repository \
--repository-name "$ECR_NAME" \ --repository-name "$ECR_NAME" \
--region "$REGION" \ --region "$REGION" \
--tag-specifications 'ResourceType=repository,Tags=[{Key=Name,Value='"$VPC_NAME"'},{Key=Owner,Value='"$OWNER"'},{Key=Project,Value='"$PROJECT"'}]' \
--query 'repository' \ --query 'repository' \
--output json) --output json)
ECR_REPO_URI=$(echo "$ECR_REPO_JSON" | jq -r '.repositoryUri') ECR_REPO_URI=$(echo "$ECR_REPO_JSON" | jq -r '.repositoryUri')
@ -81,6 +80,11 @@ if [ -z "$ECR_REPO_URI" ] || [ -z "$ECR_REPO_ARN" ]; then
fi fi
echo "ECR repository created: $ECR_REPO_URI" echo "ECR repository created: $ECR_REPO_URI"
# Adding tags to the ECR repository
aws ecr tag-resource \
--resource-arn "$ECR_REPO_ARN" \
--tags Key=Name,Value="$ECR_NAME" Key=Owner,Value="$OWNER" Key=Project,Value="$PROJECT"
echo "Tags added to ECR repository." echo "Tags added to ECR repository."