Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Replace un-maintained kubectl provider with an updated fork #1901

Merged
merged 1 commit into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/streetsidesoftware/cspell-cli
rev: v8.3.0
rev: v8.6.0
hooks:
- id: cspell
args: [--exclude, 'ADOPTERS.md', --exclude, '.pre-commit-config.yaml', --exclude, '.gitignore', --exclude, '*.drawio', --exclude, 'mkdocs.yml', --exclude, '.helmignore', --exclude, '.github/workflows/*', --exclude, 'patterns/istio-multi-cluster/*', --exclude, 'patterns/blue-green-upgrade/*']
Expand All @@ -19,7 +19,7 @@ repos:
- id: detect-aws-credentials
args: [--allow-missing-credentials]
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.86.0
rev: v1.88.1
hooks:
- id: terraform_fmt
- id: terraform_docs
Expand Down
2 changes: 1 addition & 1 deletion docs/cSpell_dict.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ addrs
adot
agones
akuity
alekc
algbw
ALLOWVOLUMEEXPANSION
amazonlinux
Expand Down Expand Up @@ -73,7 +74,6 @@ flblogs
fluentbit
gameserver
gameservers
gavinbunney
gitops
helloworld
heptio
Expand Down
4 changes: 2 additions & 2 deletions patterns/appmesh-mtls/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ terraform {
version = ">= 2.9"
}
kubectl = {
source = "gavinbunney/kubectl"
version = ">= 1.14"
source = "alekc/kubectl"
version = ">= 2.0"
}
}

Expand Down
135 changes: 69 additions & 66 deletions patterns/external-secrets/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -147,22 +147,23 @@ resource "aws_kms_key" "secrets" {
}

resource "kubectl_manifest" "cluster_secretstore" {
yaml_body = <<YAML
apiVersion: external-secrets.io/v1beta1
kind: ClusterSecretStore
metadata:
name: ${local.cluster_secretstore_name}
spec:
provider:
aws:
service: SecretsManager
region: ${local.region}
auth:
jwt:
serviceAccountRef:
name: ${local.cluster_secretstore_sa}
namespace: ${local.namespace}
YAML
yaml_body = <<YAML
apiVersion: external-secrets.io/v1beta1
kind: ClusterSecretStore
metadata:
name: ${local.cluster_secretstore_name}
spec:
provider:
aws:
service: SecretsManager
region: ${local.region}
auth:
jwt:
serviceAccountRef:
name: ${local.cluster_secretstore_sa}
namespace: ${local.namespace}
YAML

depends_on = [module.eks_blueprints_addons]
}

Expand All @@ -180,21 +181,22 @@ resource "aws_secretsmanager_secret_version" "secret" {
}

resource "kubectl_manifest" "secret" {
yaml_body = <<YAML
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: ${local.name}-sm
namespace: ${local.namespace}
spec:
refreshInterval: 1h
secretStoreRef:
name: ${local.cluster_secretstore_name}
kind: ClusterSecretStore
dataFrom:
- extract:
key: ${aws_secretsmanager_secret.secret.name}
YAML
yaml_body = <<-YAML
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: ${local.name}-sm
namespace: ${local.namespace}
spec:
refreshInterval: 1h
secretStoreRef:
name: ${local.cluster_secretstore_name}
kind: ClusterSecretStore
dataFrom:
- extract:
key: ${aws_secretsmanager_secret.secret.name}
YAML

depends_on = [kubectl_manifest.cluster_secretstore]
}

Expand All @@ -203,22 +205,23 @@ YAML
#---------------------------------------------------------------

resource "kubectl_manifest" "secretstore" {
yaml_body = <<YAML
apiVersion: external-secrets.io/v1beta1
kind: SecretStore
metadata:
name: ${local.secretstore_name}
namespace: ${local.namespace}
spec:
provider:
aws:
service: ParameterStore
region: ${local.region}
auth:
jwt:
serviceAccountRef:
name: ${local.secretstore_sa}
YAML
yaml_body = <<-YAML
apiVersion: external-secrets.io/v1beta1
kind: SecretStore
metadata:
name: ${local.secretstore_name}
namespace: ${local.namespace}
spec:
provider:
aws:
service: ParameterStore
region: ${local.region}
auth:
jwt:
serviceAccountRef:
name: ${local.secretstore_sa}
YAML

depends_on = [module.eks_blueprints_addons]
}

Expand Down Expand Up @@ -326,27 +329,27 @@ module "secretstore_role" {

resource "aws_iam_policy" "secretstore" {
name_prefix = local.secretstore_sa
policy = <<POLICY
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ssm:GetParameter*"
],
"Resource": "arn:aws:ssm:${local.region}:${data.aws_caller_identity.current.account_id}:parameter/${local.name}/*"
},
policy = <<-POLICY
{
"Effect": "Allow",
"Action": [
"kms:Decrypt"
],
"Resource": "${aws_kms_key.secrets.arn}"
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ssm:GetParameter*"
],
"Resource": "arn:aws:ssm:${local.region}:${data.aws_caller_identity.current.account_id}:parameter/${local.name}/*"
},
{
"Effect": "Allow",
"Action": [
"kms:Decrypt"
],
"Resource": "${aws_kms_key.secrets.arn}"
}
]
}
]
}
POLICY
POLICY
}

module "ebs_csi_driver_irsa" {
Expand Down
4 changes: 2 additions & 2 deletions patterns/external-secrets/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ terraform {
version = ">= 2.9"
}
kubectl = {
source = "gavinbunney/kubectl"
version = ">= 1.14"
source = "alekc/kubectl"
version = ">= 2.0"
}
}

Expand Down
16 changes: 0 additions & 16 deletions patterns/multi-tenancy-with-teams/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,6 @@ provider "kubernetes" {
token = data.aws_eks_cluster_auth.this.token
}

provider "helm" {
kubernetes {
host = module.eks.cluster_endpoint
cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data)
token = data.aws_eks_cluster_auth.this.token
}
}

provider "kubectl" {
apply_retry_count = 10
host = module.eks.cluster_endpoint
cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data)
load_config_file = false
token = data.aws_eks_cluster_auth.this.token
}

data "aws_eks_cluster_auth" "this" {
name = module.eks.cluster_name
}
Expand Down
8 changes: 0 additions & 8 deletions patterns/multi-tenancy-with-teams/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,10 @@ terraform {
source = "hashicorp/aws"
version = ">= 5.34"
}
helm = {
source = "hashicorp/helm"
version = ">= 2.9"
}
kubernetes = {
source = "hashicorp/kubernetes"
version = ">= 2.20"
}
kubectl = {
source = "gavinbunney/kubectl"
version = ">= 1.14"
}
}

# ## Used for end-to-end testing on project; update to suit your needs
Expand Down
4 changes: 2 additions & 2 deletions patterns/tls-with-aws-pca-issuer/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ terraform {
version = ">= 2.9"
}
kubectl = {
source = "gavinbunney/kubectl"
version = ">= 1.14"
source = "alekc/kubectl"
version = ">= 2.0"
}
}

Expand Down
Loading