Skip to content

Commit

Permalink
Add ValidatingWebhookConfiguration custom resource definition
Browse files Browse the repository at this point in the history
  • Loading branch information
Mitchell Huang committed Jul 15, 2020
1 parent ca650ea commit 5c21bf9
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/opa/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ variable "cert_pem" {
variable "key_pem" {
type = "string"
}

variable "ca_cert_pem" {
type = "string"
}
49 changes: 49 additions & 0 deletions modules/opa/webhook.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
resource "kubernetes_manifest" "opa_validating_webhook_configuration" {
manifest = {
"apiVersion" = "admissionregistration.k8s.io/v1beta1"
"kind" = "ValidatingWebhookConfiguration"
"metadata" = {
"name" = "opa-validating-webhook"
}
"webhooks" = [
{
"clientConfig" = {
"caBundle" = filebase64("${var.ca_cert_pem}")
"service" = {
"name" = "opa"
"namespace" = "opa"
}
}
"name" = "validating-webhook.openpolicyagent.org"
"namespaceSelector" = {
"matchExpressions" = [
{
"key" = "openpolicyagent.org/webhook"
"operator" = "NotIn"
"values" = [
"ignore",
]
},
]
}
"rules" = [
{
"apiGroups" = [
"*",
]
"apiVersions" = [
"*",
]
"operations" = [
"CREATE",
"UPDATE",
]
"resources" = [
"*",
]
},
]
},
]
}
}
1 change: 1 addition & 0 deletions platforms/aws/opa.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module "opa" {

cert_pem = "${module.opa_certs.cert_pem}"
key_pem = "${module.opa_certs.key_pem}"
ca_cert_pem = "placeholder"
}

provider "kubernetes" {
Expand Down

0 comments on commit 5c21bf9

Please sign in to comment.