Skip to content

Commit

Permalink
update data source and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
fairclothjm committed Nov 4, 2024
1 parent b78ae51 commit c9d5a8e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
10 changes: 10 additions & 0 deletions vault/data_source_kubernetes_auth_backend_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ func kubernetesAuthBackendConfigDataSource() *schema.Resource {
Optional: true,
Description: "Optional disable defaulting to the local CA cert and service account JWT when running in a Kubernetes pod.",
},
fieldUseAnnotationsAsAliasMetadata: {
Type: schema.TypeBool,
Computed: true,
Optional: true,
Description: "Use annotations from the client token's associated service account as alias metadata for the Vault entity.",
},
},
}
}
Expand Down Expand Up @@ -105,5 +111,9 @@ func kubernetesAuthBackendConfigDataSourceRead(d *schema.ResourceData, meta inte
d.Set(consts.FieldDisableISSValidation, resp.Data[consts.FieldDisableISSValidation])
d.Set(consts.FieldDisableLocalCAJWT, resp.Data[consts.FieldDisableLocalCAJWT])

if provider.IsAPISupported(meta, provider.VaultVersion116) {
d.Set(fieldUseAnnotationsAsAliasMetadata, resp.Data[fieldUseAnnotationsAsAliasMetadata])
}

return nil
}
5 changes: 5 additions & 0 deletions vault/data_source_kubernetes_auth_backend_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func TestAccKubernetesAuthBackendConfigDataSource_full(t *testing.T) {
issuer := "kubernetes/serviceaccount"
disableIssValidation := true
disableLocalCaJwt := true
useAnnotationsAsAliasMetadata := true

resource.Test(t, resource.TestCase{
PreCheck: func() { testutil.TestAccPreCheck(t) },
Expand Down Expand Up @@ -90,6 +91,8 @@ func TestAccKubernetesAuthBackendConfigDataSource_full(t *testing.T) {
consts.FieldDisableISSValidation, strconv.FormatBool(disableIssValidation)),
resource.TestCheckResourceAttr("vault_kubernetes_auth_backend_config.config",
consts.FieldDisableLocalCAJWT, strconv.FormatBool(disableLocalCaJwt)),
resource.TestCheckResourceAttr("vault_kubernetes_auth_backend_config.config",
fieldUseAnnotationsAsAliasMetadata, strconv.FormatBool(useAnnotationsAsAliasMetadata)),
),
},
{
Expand All @@ -113,6 +116,8 @@ func TestAccKubernetesAuthBackendConfigDataSource_full(t *testing.T) {
consts.FieldDisableISSValidation, strconv.FormatBool(disableIssValidation)),
resource.TestCheckResourceAttr("vault_kubernetes_auth_backend_config.config",
consts.FieldDisableLocalCAJWT, strconv.FormatBool(disableLocalCaJwt)),
resource.TestCheckResourceAttr("vault_kubernetes_auth_backend_config.config",
fieldUseAnnotationsAsAliasMetadata, strconv.FormatBool(useAnnotationsAsAliasMetadata)),
),
},
},
Expand Down
6 changes: 6 additions & 0 deletions website/docs/d/kubernetes_auth_backend_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,9 @@ In addition to the above arguments, the following attributes are exported:
* `pem_keys` - Optional list of PEM-formatted public keys or certificates used to verify the signatures of Kubernetes service account JWTs. If a certificate is given, its public key will be extracted. Not every installation of Kubernetes exposes these keys.

* `issuer` - Optional JWT issuer. If no issuer is specified, `kubernetes.io/serviceaccount` will be used as the default issuer.

* `disable_iss_validation` - (Optional) Disable JWT issuer validation. Allows to skip ISS validation. Requires Vault `v1.5.4+` or Vault auth kubernetes plugin `v0.7.1+`

* `disable_local_ca_jwt` - (Optional) Disable defaulting to the local CA cert and service account JWT when running in a Kubernetes pod. Requires Vault `v1.5.4+` or Vault auth kubernetes plugin `v0.7.1+`

* `use_annotations_as_alias_metadata` - (Optional) Use annotations from the client token's associated service account as alias metadata for the Vault entity. Requires Vault `v1.16+` or Vault auth kubernetes plugin `v0.18.0+`
2 changes: 2 additions & 0 deletions website/docs/r/kubernetes_auth_backend_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ The following arguments are supported:

* `disable_local_ca_jwt` - (Optional) Disable defaulting to the local CA cert and service account JWT when running in a Kubernetes pod. Requires Vault `v1.5.4+` or Vault auth kubernetes plugin `v0.7.1+`

* `use_annotations_as_alias_metadata` - (Optional) Use annotations from the client token's associated service account as alias metadata for the Vault entity. Requires Vault `v1.16+` or Vault auth kubernetes plugin `v0.18.0+`


## Attributes Reference

Expand Down

0 comments on commit c9d5a8e

Please sign in to comment.