From e045752708c4e2ea9e35642bf959bffdcfaec4eb Mon Sep 17 00:00:00 2001 From: Jaylon McShan Date: Fri, 15 Nov 2024 18:14:56 -0600 Subject: [PATCH] Removing traces of the deprecated resource --- docs/resources/pod_security_policy.md | 273 ------------------ docs/resources/pod_security_policy_v1beta1.md | 273 ------------------ .../pod_security_policy/example_1.tf | 44 --- .../pod_security_policy_v1beta1/example_1.tf | 44 --- .../resources/pod_security_policy.md.tmpl | 26 -- .../pod_security_policy_v1beta1.md.tmpl | 26 -- 6 files changed, 686 deletions(-) delete mode 100644 docs/resources/pod_security_policy.md delete mode 100644 docs/resources/pod_security_policy_v1beta1.md delete mode 100644 examples/resources/pod_security_policy/example_1.tf delete mode 100644 examples/resources/pod_security_policy_v1beta1/example_1.tf delete mode 100644 templates/resources/pod_security_policy.md.tmpl delete mode 100644 templates/resources/pod_security_policy_v1beta1.md.tmpl diff --git a/docs/resources/pod_security_policy.md b/docs/resources/pod_security_policy.md deleted file mode 100644 index cbd540762f..0000000000 --- a/docs/resources/pod_security_policy.md +++ /dev/null @@ -1,273 +0,0 @@ ---- -subcategory: "policy/v1beta1" -page_title: "Kubernetes: kubernetes_pod_security_policy" -description: |- - A Pod Security Policy is a cluster-level resource that controls security sensitive aspects of the pod specification. ---- - -# kubernetes_pod_security_policy - -A Pod Security Policy is a cluster-level resource that controls security sensitive aspects of the pod specification. The PodSecurityPolicy objects define a set of conditions that a pod must run with in order to be accepted into the system, as well as defaults for the related fields. - - -## Schema - -### Required - -- `metadata` (Block List, Min: 1, Max: 1) Standard podsecuritypolicy's metadata. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata (see [below for nested schema](#nestedblock--metadata)) -- `spec` (Block List, Min: 1, Max: 1) spec defines the policy enforced. (see [below for nested schema](#nestedblock--spec)) - -### Read-Only - -- `id` (String) The ID of this resource. - - -### Nested Schema for `metadata` - -Optional: - -- `annotations` (Map of String) An unstructured key value map stored with the podsecuritypolicy that may be used to store arbitrary metadata. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ -- `labels` (Map of String) Map of string keys and values that can be used to organize and categorize (scope and select) the podsecuritypolicy. May match selectors of replication controllers and services. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ -- `name` (String) Name of the podsecuritypolicy, must be unique. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - -Read-Only: - -- `generation` (Number) A sequence number representing a specific generation of the desired state. -- `resource_version` (String) An opaque value that represents the internal version of this podsecuritypolicy that can be used by clients to determine when podsecuritypolicy has changed. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency -- `uid` (String) The unique in time and space value for this podsecuritypolicy. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids - - - -### Nested Schema for `spec` - -Required: - -- `fs_group` (Block List, Min: 1, Max: 1) fsGroup is the strategy that will dictate what fs group is used by the SecurityContext. (see [below for nested schema](#nestedblock--spec--fs_group)) -- `run_as_user` (Block List, Min: 1, Max: 1) runAsUser is the strategy that will dictate the allowable RunAsUser values that may be set. (see [below for nested schema](#nestedblock--spec--run_as_user)) -- `supplemental_groups` (Block List, Min: 1, Max: 1) supplementalGroups is the strategy that will dictate what supplemental groups are used by the SecurityContext. (see [below for nested schema](#nestedblock--spec--supplemental_groups)) - -Optional: - -- `allow_privilege_escalation` (Boolean) allowPrivilegeEscalation determines if a pod can request to allow privilege escalation. If unspecified, defaults to true. -- `allowed_capabilities` (List of String) allowedCapabilities is a list of capabilities that can be requested to add to the container. Capabilities in this field may be added at the pod author's discretion. You must not list a capability in both allowedCapabilities and requiredDropCapabilities. -- `allowed_flex_volumes` (Block List) allowedFlexVolumes is an allowlist of Flexvolumes. Empty or nil indicates that all Flexvolumes may be used. This parameter is effective only when the usage of the Flexvolumes is allowed in the "volumes" field. (see [below for nested schema](#nestedblock--spec--allowed_flex_volumes)) -- `allowed_host_paths` (Block List) allowedHostPaths is an allowlist of host paths. Empty indicates that all host paths may be used. (see [below for nested schema](#nestedblock--spec--allowed_host_paths)) -- `allowed_proc_mount_types` (List of String) AllowedProcMountTypes is an allowlist of allowed ProcMountTypes. Empty or nil indicates that only the DefaultProcMountType may be used. This requires the ProcMountType feature flag to be enabled. -- `allowed_unsafe_sysctls` (List of String) allowedUnsafeSysctls is a list of explicitly allowed unsafe sysctls, defaults to none. Each entry is either a plain sysctl name or ends in "*" in which case it is considered as a prefix of allowed sysctls. Single * means all unsafe sysctls are allowed. Kubelet has to allowlist all allowed unsafe sysctls explicitly to avoid rejection. - -Examples: e.g. "foo/*" allows "foo/bar", "foo/baz", etc. e.g. "foo.*" allows "foo.bar", "foo.baz", etc. -- `default_add_capabilities` (List of String) defaultAddCapabilities is the default set of capabilities that will be added to the container unless the pod spec specifically drops the capability. You may not list a capability in both defaultAddCapabilities and requiredDropCapabilities. Capabilities added here are implicitly allowed, and need not be included in the allowedCapabilities list. -- `default_allow_privilege_escalation` (Boolean) defaultAllowPrivilegeEscalation controls the default setting for whether a process can gain more privileges than its parent process. -- `forbidden_sysctls` (List of String) forbiddenSysctls is a list of explicitly forbidden sysctls, defaults to none. Each entry is either a plain sysctl name or ends in "*" in which case it is considered as a prefix of forbidden sysctls. Single * means all sysctls are forbidden. - -Examples: e.g. "foo/*" forbids "foo/bar", "foo/baz", etc. e.g. "foo.*" forbids "foo.bar", "foo.baz", etc. -- `host_ipc` (Boolean) hostIPC determines if the policy allows the use of HostIPC in the pod spec. -- `host_network` (Boolean) hostNetwork determines if the policy allows the use of HostNetwork in the pod spec. -- `host_pid` (Boolean) hostPID determines if the policy allows the use of HostPID in the pod spec. -- `host_ports` (Block List) hostPorts determines which host port ranges are allowed to be exposed. (see [below for nested schema](#nestedblock--spec--host_ports)) -- `privileged` (Boolean) privileged determines if a pod can request to be run as privileged. -- `read_only_root_filesystem` (Boolean) readOnlyRootFilesystem when set to true will force containers to run with a read only root file system. If the container specifically requests to run with a non-read only root file system the PSP should deny the pod. If set to false the container may run with a read only root file system if it wishes but it will not be forced to. -- `required_drop_capabilities` (List of String) requiredDropCapabilities are the capabilities that will be dropped from the container. These are required to be dropped and cannot be added. -- `run_as_group` (Block List, Max: 1) RunAsGroup is the strategy that will dictate the allowable RunAsGroup values that may be set. If this field is omitted, the pod's RunAsGroup can take any value. This field requires the RunAsGroup feature gate to be enabled. (see [below for nested schema](#nestedblock--spec--run_as_group)) -- `se_linux` (Block List, Max: 1) seLinux is the strategy that will dictate the allowable labels that may be set. (see [below for nested schema](#nestedblock--spec--se_linux)) -- `volumes` (List of String) volumes is an allowlist of volume plugins. Empty indicates that no volumes may be used. To allow all volumes you may use '*'. - - -### Nested Schema for `spec.fs_group` - -Required: - -- `rule` (String) rule is the strategy that will dictate what FSGroup is used in the SecurityContext. - -Optional: - -- `range` (Block List) ranges are the allowed ranges of fs groups. If you would like to force a single fs group then supply a single range with the same start and end. Required for MustRunAs. (see [below for nested schema](#nestedblock--spec--fs_group--range)) - - -### Nested Schema for `spec.fs_group.range` - -Required: - -- `max` (Number) max is the end of the range, inclusive. -- `min` (Number) min is the start of the range, inclusive. - - - - -### Nested Schema for `spec.run_as_user` - -Required: - -- `rule` (String) rule is the strategy that will dictate the allowable RunAsUser values that may be set. - -Optional: - -- `range` (Block List) ranges are the allowed ranges of uids that may be used. If you would like to force a single uid then supply a single range with the same start and end. Required for MustRunAs. (see [below for nested schema](#nestedblock--spec--run_as_user--range)) - - -### Nested Schema for `spec.run_as_user.range` - -Required: - -- `max` (Number) max is the end of the range, inclusive. -- `min` (Number) min is the start of the range, inclusive. - - - - -### Nested Schema for `spec.supplemental_groups` - -Required: - -- `rule` (String) rule is the strategy that will dictate what supplemental groups is used in the SecurityContext. - -Optional: - -- `range` (Block List) ranges are the allowed ranges of supplemental groups. If you would like to force a single supplemental group then supply a single range with the same start and end. Required for MustRunAs. (see [below for nested schema](#nestedblock--spec--supplemental_groups--range)) - - -### Nested Schema for `spec.supplemental_groups.range` - -Required: - -- `max` (Number) max is the end of the range, inclusive. -- `min` (Number) min is the start of the range, inclusive. - - - - -### Nested Schema for `spec.allowed_flex_volumes` - -Required: - -- `driver` (String) driver is the name of the Flexvolume driver. - - - -### Nested Schema for `spec.allowed_host_paths` - -Required: - -- `path_prefix` (String) pathPrefix is the path prefix that the host volume must match. It does not support `*`. Trailing slashes are trimmed when validating the path prefix with a host path. - -Examples: `/foo` would allow `/foo`, `/foo/` and `/foo/bar` `/foo` would not allow `/food` or `/etc/foo` - -Optional: - -- `read_only` (Boolean) when set to true, will allow host volumes matching the pathPrefix only if all volume mounts are readOnly. - - - -### Nested Schema for `spec.host_ports` - -Required: - -- `max` (Number) max is the end of the range, inclusive. -- `min` (Number) min is the start of the range, inclusive. - - - -### Nested Schema for `spec.run_as_group` - -Required: - -- `rule` (String) rule is the strategy that will dictate the allowable RunAsGroup values that may be set. - -Optional: - -- `range` (Block List) ranges are the allowed ranges of gids that may be used. If you would like to force a single gid then supply a single range with the same start and end. Required for MustRunAs. (see [below for nested schema](#nestedblock--spec--run_as_group--range)) - - -### Nested Schema for `spec.run_as_group.range` - -Required: - -- `max` (Number) max is the end of the range, inclusive. -- `min` (Number) min is the start of the range, inclusive. - - - - -### Nested Schema for `spec.se_linux` - -Required: - -- `rule` (String) rule is the strategy that will dictate the allowable labels that may be set. - -Optional: - -- `se_linux_options` (Block List) seLinuxOptions required to run as; required for MustRunAs More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ (see [below for nested schema](#nestedblock--spec--se_linux--se_linux_options)) - - -### Nested Schema for `spec.se_linux.se_linux_options` - -Required: - -- `level` (String) -- `role` (String) -- `type` (String) -- `user` (String) - - - - - - -~> NOTE: With the release of Kubernetes v1.25, PodSecurityPolicy has been removed. You can read more information about the removal of PodSecurityPolicy in the [Kubernetes 1.25 release notes](https://kubernetes.io/blog/2022/08/23/kubernetes-v1-25-release/#pod-security-changes). - -## Example Usage - -```terraform -resource "kubernetes_pod_security_policy" "example" { - metadata { - name = "terraform-example" - } - spec { - privileged = false - allow_privilege_escalation = false - - volumes = [ - "configMap", - "emptyDir", - "projected", - "secret", - "downwardAPI", - "persistentVolumeClaim", - ] - - run_as_user { - rule = "MustRunAsNonRoot" - } - - se_linux { - rule = "RunAsAny" - } - - supplemental_groups { - rule = "MustRunAs" - range { - min = 1 - max = 65535 - } - } - - fs_group { - rule = "MustRunAs" - range { - min = 1 - max = 65535 - } - } - - read_only_root_filesystem = true - } -} -``` - -## Import - -Pod Security Policy can be imported using its name, e.g. - -``` -$ terraform import kubernetes_pod_security_policy.example terraform-example -``` diff --git a/docs/resources/pod_security_policy_v1beta1.md b/docs/resources/pod_security_policy_v1beta1.md deleted file mode 100644 index 3cfca4e8b0..0000000000 --- a/docs/resources/pod_security_policy_v1beta1.md +++ /dev/null @@ -1,273 +0,0 @@ ---- -subcategory: "policy/v1beta1" -page_title: "Kubernetes: kubernetes_pod_security_policy_v1beta1" -description: |- - A Pod Security Policy is a cluster-level resource that controls security sensitive aspects of the pod specification. ---- - -# kubernetes_pod_security_policy_v1beta1 - -A Pod Security Policy is a cluster-level resource that controls security sensitive aspects of the pod specification. The PodSecurityPolicy objects define a set of conditions that a pod must run with in order to be accepted into the system, as well as defaults for the related fields. - - -## Schema - -### Required - -- `metadata` (Block List, Min: 1, Max: 1) Standard podsecuritypolicy's metadata. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata (see [below for nested schema](#nestedblock--metadata)) -- `spec` (Block List, Min: 1, Max: 1) spec defines the policy enforced. (see [below for nested schema](#nestedblock--spec)) - -### Read-Only - -- `id` (String) The ID of this resource. - - -### Nested Schema for `metadata` - -Optional: - -- `annotations` (Map of String) An unstructured key value map stored with the podsecuritypolicy that may be used to store arbitrary metadata. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ -- `labels` (Map of String) Map of string keys and values that can be used to organize and categorize (scope and select) the podsecuritypolicy. May match selectors of replication controllers and services. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ -- `name` (String) Name of the podsecuritypolicy, must be unique. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - -Read-Only: - -- `generation` (Number) A sequence number representing a specific generation of the desired state. -- `resource_version` (String) An opaque value that represents the internal version of this podsecuritypolicy that can be used by clients to determine when podsecuritypolicy has changed. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency -- `uid` (String) The unique in time and space value for this podsecuritypolicy. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids - - - -### Nested Schema for `spec` - -Required: - -- `fs_group` (Block List, Min: 1, Max: 1) fsGroup is the strategy that will dictate what fs group is used by the SecurityContext. (see [below for nested schema](#nestedblock--spec--fs_group)) -- `run_as_user` (Block List, Min: 1, Max: 1) runAsUser is the strategy that will dictate the allowable RunAsUser values that may be set. (see [below for nested schema](#nestedblock--spec--run_as_user)) -- `supplemental_groups` (Block List, Min: 1, Max: 1) supplementalGroups is the strategy that will dictate what supplemental groups are used by the SecurityContext. (see [below for nested schema](#nestedblock--spec--supplemental_groups)) - -Optional: - -- `allow_privilege_escalation` (Boolean) allowPrivilegeEscalation determines if a pod can request to allow privilege escalation. If unspecified, defaults to true. -- `allowed_capabilities` (List of String) allowedCapabilities is a list of capabilities that can be requested to add to the container. Capabilities in this field may be added at the pod author's discretion. You must not list a capability in both allowedCapabilities and requiredDropCapabilities. -- `allowed_flex_volumes` (Block List) allowedFlexVolumes is an allowlist of Flexvolumes. Empty or nil indicates that all Flexvolumes may be used. This parameter is effective only when the usage of the Flexvolumes is allowed in the "volumes" field. (see [below for nested schema](#nestedblock--spec--allowed_flex_volumes)) -- `allowed_host_paths` (Block List) allowedHostPaths is an allowlist of host paths. Empty indicates that all host paths may be used. (see [below for nested schema](#nestedblock--spec--allowed_host_paths)) -- `allowed_proc_mount_types` (List of String) AllowedProcMountTypes is an allowlist of allowed ProcMountTypes. Empty or nil indicates that only the DefaultProcMountType may be used. This requires the ProcMountType feature flag to be enabled. -- `allowed_unsafe_sysctls` (List of String) allowedUnsafeSysctls is a list of explicitly allowed unsafe sysctls, defaults to none. Each entry is either a plain sysctl name or ends in "*" in which case it is considered as a prefix of allowed sysctls. Single * means all unsafe sysctls are allowed. Kubelet has to allowlist all allowed unsafe sysctls explicitly to avoid rejection. - -Examples: e.g. "foo/*" allows "foo/bar", "foo/baz", etc. e.g. "foo.*" allows "foo.bar", "foo.baz", etc. -- `default_add_capabilities` (List of String) defaultAddCapabilities is the default set of capabilities that will be added to the container unless the pod spec specifically drops the capability. You may not list a capability in both defaultAddCapabilities and requiredDropCapabilities. Capabilities added here are implicitly allowed, and need not be included in the allowedCapabilities list. -- `default_allow_privilege_escalation` (Boolean) defaultAllowPrivilegeEscalation controls the default setting for whether a process can gain more privileges than its parent process. -- `forbidden_sysctls` (List of String) forbiddenSysctls is a list of explicitly forbidden sysctls, defaults to none. Each entry is either a plain sysctl name or ends in "*" in which case it is considered as a prefix of forbidden sysctls. Single * means all sysctls are forbidden. - -Examples: e.g. "foo/*" forbids "foo/bar", "foo/baz", etc. e.g. "foo.*" forbids "foo.bar", "foo.baz", etc. -- `host_ipc` (Boolean) hostIPC determines if the policy allows the use of HostIPC in the pod spec. -- `host_network` (Boolean) hostNetwork determines if the policy allows the use of HostNetwork in the pod spec. -- `host_pid` (Boolean) hostPID determines if the policy allows the use of HostPID in the pod spec. -- `host_ports` (Block List) hostPorts determines which host port ranges are allowed to be exposed. (see [below for nested schema](#nestedblock--spec--host_ports)) -- `privileged` (Boolean) privileged determines if a pod can request to be run as privileged. -- `read_only_root_filesystem` (Boolean) readOnlyRootFilesystem when set to true will force containers to run with a read only root file system. If the container specifically requests to run with a non-read only root file system the PSP should deny the pod. If set to false the container may run with a read only root file system if it wishes but it will not be forced to. -- `required_drop_capabilities` (List of String) requiredDropCapabilities are the capabilities that will be dropped from the container. These are required to be dropped and cannot be added. -- `run_as_group` (Block List, Max: 1) RunAsGroup is the strategy that will dictate the allowable RunAsGroup values that may be set. If this field is omitted, the pod's RunAsGroup can take any value. This field requires the RunAsGroup feature gate to be enabled. (see [below for nested schema](#nestedblock--spec--run_as_group)) -- `se_linux` (Block List, Max: 1) seLinux is the strategy that will dictate the allowable labels that may be set. (see [below for nested schema](#nestedblock--spec--se_linux)) -- `volumes` (List of String) volumes is an allowlist of volume plugins. Empty indicates that no volumes may be used. To allow all volumes you may use '*'. - - -### Nested Schema for `spec.fs_group` - -Required: - -- `rule` (String) rule is the strategy that will dictate what FSGroup is used in the SecurityContext. - -Optional: - -- `range` (Block List) ranges are the allowed ranges of fs groups. If you would like to force a single fs group then supply a single range with the same start and end. Required for MustRunAs. (see [below for nested schema](#nestedblock--spec--fs_group--range)) - - -### Nested Schema for `spec.fs_group.range` - -Required: - -- `max` (Number) max is the end of the range, inclusive. -- `min` (Number) min is the start of the range, inclusive. - - - - -### Nested Schema for `spec.run_as_user` - -Required: - -- `rule` (String) rule is the strategy that will dictate the allowable RunAsUser values that may be set. - -Optional: - -- `range` (Block List) ranges are the allowed ranges of uids that may be used. If you would like to force a single uid then supply a single range with the same start and end. Required for MustRunAs. (see [below for nested schema](#nestedblock--spec--run_as_user--range)) - - -### Nested Schema for `spec.run_as_user.range` - -Required: - -- `max` (Number) max is the end of the range, inclusive. -- `min` (Number) min is the start of the range, inclusive. - - - - -### Nested Schema for `spec.supplemental_groups` - -Required: - -- `rule` (String) rule is the strategy that will dictate what supplemental groups is used in the SecurityContext. - -Optional: - -- `range` (Block List) ranges are the allowed ranges of supplemental groups. If you would like to force a single supplemental group then supply a single range with the same start and end. Required for MustRunAs. (see [below for nested schema](#nestedblock--spec--supplemental_groups--range)) - - -### Nested Schema for `spec.supplemental_groups.range` - -Required: - -- `max` (Number) max is the end of the range, inclusive. -- `min` (Number) min is the start of the range, inclusive. - - - - -### Nested Schema for `spec.allowed_flex_volumes` - -Required: - -- `driver` (String) driver is the name of the Flexvolume driver. - - - -### Nested Schema for `spec.allowed_host_paths` - -Required: - -- `path_prefix` (String) pathPrefix is the path prefix that the host volume must match. It does not support `*`. Trailing slashes are trimmed when validating the path prefix with a host path. - -Examples: `/foo` would allow `/foo`, `/foo/` and `/foo/bar` `/foo` would not allow `/food` or `/etc/foo` - -Optional: - -- `read_only` (Boolean) when set to true, will allow host volumes matching the pathPrefix only if all volume mounts are readOnly. - - - -### Nested Schema for `spec.host_ports` - -Required: - -- `max` (Number) max is the end of the range, inclusive. -- `min` (Number) min is the start of the range, inclusive. - - - -### Nested Schema for `spec.run_as_group` - -Required: - -- `rule` (String) rule is the strategy that will dictate the allowable RunAsGroup values that may be set. - -Optional: - -- `range` (Block List) ranges are the allowed ranges of gids that may be used. If you would like to force a single gid then supply a single range with the same start and end. Required for MustRunAs. (see [below for nested schema](#nestedblock--spec--run_as_group--range)) - - -### Nested Schema for `spec.run_as_group.range` - -Required: - -- `max` (Number) max is the end of the range, inclusive. -- `min` (Number) min is the start of the range, inclusive. - - - - -### Nested Schema for `spec.se_linux` - -Required: - -- `rule` (String) rule is the strategy that will dictate the allowable labels that may be set. - -Optional: - -- `se_linux_options` (Block List) seLinuxOptions required to run as; required for MustRunAs More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ (see [below for nested schema](#nestedblock--spec--se_linux--se_linux_options)) - - -### Nested Schema for `spec.se_linux.se_linux_options` - -Required: - -- `level` (String) -- `role` (String) -- `type` (String) -- `user` (String) - - - - - - -~> NOTE: With the release of Kubernetes v1.25, PodSecurityPolicy has been removed. You can read more information about the removal of PodSecurityPolicy in the [Kubernetes 1.25 release notes](https://kubernetes.io/blog/2022/08/23/kubernetes-v1-25-release/#pod-security-changes). - -## Example Usage - -```terraform -resource "kubernetes_pod_security_policy_v1beta1" "example" { - metadata { - name = "terraform-example" - } - spec { - privileged = false - allow_privilege_escalation = false - - volumes = [ - "configMap", - "emptyDir", - "projected", - "secret", - "downwardAPI", - "persistentVolumeClaim", - ] - - run_as_user { - rule = "MustRunAsNonRoot" - } - - se_linux { - rule = "RunAsAny" - } - - supplemental_groups { - rule = "MustRunAs" - range { - min = 1 - max = 65535 - } - } - - fs_group { - rule = "MustRunAs" - range { - min = 1 - max = 65535 - } - } - - read_only_root_filesystem = true - } -} -``` - -## Import - -Pod Security Policy can be imported using its name, e.g. - -``` -$ terraform import kubernetes_pod_security_policy_v1beta1.example terraform-example -``` diff --git a/examples/resources/pod_security_policy/example_1.tf b/examples/resources/pod_security_policy/example_1.tf deleted file mode 100644 index f166b3c086..0000000000 --- a/examples/resources/pod_security_policy/example_1.tf +++ /dev/null @@ -1,44 +0,0 @@ -resource "kubernetes_pod_security_policy" "example" { - metadata { - name = "terraform-example" - } - spec { - privileged = false - allow_privilege_escalation = false - - volumes = [ - "configMap", - "emptyDir", - "projected", - "secret", - "downwardAPI", - "persistentVolumeClaim", - ] - - run_as_user { - rule = "MustRunAsNonRoot" - } - - se_linux { - rule = "RunAsAny" - } - - supplemental_groups { - rule = "MustRunAs" - range { - min = 1 - max = 65535 - } - } - - fs_group { - rule = "MustRunAs" - range { - min = 1 - max = 65535 - } - } - - read_only_root_filesystem = true - } -} diff --git a/examples/resources/pod_security_policy_v1beta1/example_1.tf b/examples/resources/pod_security_policy_v1beta1/example_1.tf deleted file mode 100644 index 9ac7b6fd09..0000000000 --- a/examples/resources/pod_security_policy_v1beta1/example_1.tf +++ /dev/null @@ -1,44 +0,0 @@ -resource "kubernetes_pod_security_policy_v1beta1" "example" { - metadata { - name = "terraform-example" - } - spec { - privileged = false - allow_privilege_escalation = false - - volumes = [ - "configMap", - "emptyDir", - "projected", - "secret", - "downwardAPI", - "persistentVolumeClaim", - ] - - run_as_user { - rule = "MustRunAsNonRoot" - } - - se_linux { - rule = "RunAsAny" - } - - supplemental_groups { - rule = "MustRunAs" - range { - min = 1 - max = 65535 - } - } - - fs_group { - rule = "MustRunAs" - range { - min = 1 - max = 65535 - } - } - - read_only_root_filesystem = true - } -} diff --git a/templates/resources/pod_security_policy.md.tmpl b/templates/resources/pod_security_policy.md.tmpl deleted file mode 100644 index aeb59bd85f..0000000000 --- a/templates/resources/pod_security_policy.md.tmpl +++ /dev/null @@ -1,26 +0,0 @@ ---- -subcategory: "policy/v1beta1" -page_title: "Kubernetes: kubernetes_pod_security_policy" -description: |- - A Pod Security Policy is a cluster-level resource that controls security sensitive aspects of the pod specification. ---- - -# {{ .Name }} - -A Pod Security Policy is a cluster-level resource that controls security sensitive aspects of the pod specification. The PodSecurityPolicy objects define a set of conditions that a pod must run with in order to be accepted into the system, as well as defaults for the related fields. - -{{ .SchemaMarkdown }} - -~> NOTE: With the release of Kubernetes v1.25, PodSecurityPolicy has been removed. You can read more information about the removal of PodSecurityPolicy in the [Kubernetes 1.25 release notes](https://kubernetes.io/blog/2022/08/23/kubernetes-v1-25-release/#pod-security-changes). - -## Example Usage - -{{tffile "examples/resources/pod_security_policy/example_1.tf"}} - -## Import - -Pod Security Policy can be imported using its name, e.g. - -``` -$ terraform import kubernetes_pod_security_policy.example terraform-example -``` diff --git a/templates/resources/pod_security_policy_v1beta1.md.tmpl b/templates/resources/pod_security_policy_v1beta1.md.tmpl deleted file mode 100644 index c6ad622307..0000000000 --- a/templates/resources/pod_security_policy_v1beta1.md.tmpl +++ /dev/null @@ -1,26 +0,0 @@ ---- -subcategory: "policy/v1beta1" -page_title: "Kubernetes: kubernetes_pod_security_policy_v1beta1" -description: |- - A Pod Security Policy is a cluster-level resource that controls security sensitive aspects of the pod specification. ---- - -# {{ .Name }} - -{{ .Description }} - -{{ .SchemaMarkdown }} - -~> NOTE: With the release of Kubernetes v1.25, PodSecurityPolicy has been removed. You can read more information about the removal of PodSecurityPolicy in the [Kubernetes 1.25 release notes](https://kubernetes.io/blog/2022/08/23/kubernetes-v1-25-release/#pod-security-changes). - -## Example Usage - -{{tffile "examples/resources/pod_security_policy_v1beta1/example_1.tf"}} - -## Import - -Pod Security Policy can be imported using its name, e.g. - -``` -$ terraform import kubernetes_pod_security_policy_v1beta1.example terraform-example -```