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

Regenerate resources to support default namespace #2640

Draft
wants to merge 1 commit into
base: add-codegen
Choose a base branch
from
Draft
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
5 changes: 5 additions & 0 deletions internal/framework/provider/appsv1/daemon_set_schema_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/types"
)
Expand Down Expand Up @@ -55,6 +56,7 @@ Applied only if Name is not specified. More info: https://git.k8s.io/community/c
MarkdownDescription: `Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names`,
Optional: true,
Computed: true,

PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
Expand All @@ -64,6 +66,9 @@ Applied only if Name is not specified. More info: https://git.k8s.io/community/c

Must be a DNS_LABEL. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces`,
Optional: true,
Computed: true,

Default: stringdefault.StaticString("default"),
},
"resource_version": schema.StringAttribute{
MarkdownDescription: `An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources.
Expand Down
5 changes: 5 additions & 0 deletions internal/framework/provider/appsv1/deployment_schema_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/types"
)
Expand Down Expand Up @@ -55,6 +56,7 @@ Applied only if Name is not specified. More info: https://git.k8s.io/community/c
MarkdownDescription: `Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names`,
Optional: true,
Computed: true,

PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
Expand All @@ -64,6 +66,9 @@ Applied only if Name is not specified. More info: https://git.k8s.io/community/c

Must be a DNS_LABEL. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces`,
Optional: true,
Computed: true,

Default: stringdefault.StaticString("default"),
},
"resource_version": schema.StringAttribute{
MarkdownDescription: `An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ resource "kubernetes_daemon_set_v1_gen" {
"metadata.resource_version",
"metadata.generation",
"metadata.name",
"metadata.namespace"
]

immutable_attributes = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ resource "kubernetes_deployment_v1_gen" {
"metadata.resource_version",
"metadata.generation",
"metadata.name",
"metadata.namespace"
]

immutable_attributes = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ resource "kubernetes_stateful_set_v1_gen" {
"metadata.resource_version",
"metadata.generation",
"metadata.name",
"metadata.namespace"
]

immutable_attributes = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/types"
)
Expand Down Expand Up @@ -55,6 +56,7 @@ Applied only if Name is not specified. More info: https://git.k8s.io/community/c
MarkdownDescription: `Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names`,
Optional: true,
Computed: true,

PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
Expand All @@ -64,6 +66,9 @@ Applied only if Name is not specified. More info: https://git.k8s.io/community/c

Must be a DNS_LABEL. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces`,
Optional: true,
Computed: true,

Default: stringdefault.StaticString("default"),
},
"resource_version": schema.StringAttribute{
MarkdownDescription: `An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources.
Expand Down
5 changes: 5 additions & 0 deletions internal/framework/provider/batchv1/cronjob_schema_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/types"
)
Expand Down Expand Up @@ -55,6 +56,7 @@ Applied only if Name is not specified. More info: https://git.k8s.io/community/c
MarkdownDescription: `Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names`,
Optional: true,
Computed: true,

PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
Expand All @@ -64,6 +66,9 @@ Applied only if Name is not specified. More info: https://git.k8s.io/community/c

Must be a DNS_LABEL. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces`,
Optional: true,
Computed: true,

Default: stringdefault.StaticString("default"),
},
"resource_version": schema.StringAttribute{
MarkdownDescription: `An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ resource "kubernetes_cron_job_v1_gen" {
"metadata.resource_version",
"metadata.generation",
"metadata.name",
"metadata.namespace"
]

immutable_attributes = [
Expand Down
1 change: 1 addition & 0 deletions internal/framework/provider/batchv1/generate_job.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ resource "kubernetes_job_v1_gen" {
"metadata.resource_version",
"metadata.generation",
"metadata.name",
"metadata.namespace"
]

immutable_attributes = [
Expand Down
6 changes: 6 additions & 0 deletions internal/framework/provider/batchv1/job_schema_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/objectplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/types"
)
Expand Down Expand Up @@ -56,6 +57,7 @@ Applied only if Name is not specified. More info: https://git.k8s.io/community/c
MarkdownDescription: `Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names`,
Optional: true,
Computed: true,

PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
Expand All @@ -65,6 +67,9 @@ Applied only if Name is not specified. More info: https://git.k8s.io/community/c

Must be a DNS_LABEL. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces`,
Optional: true,
Computed: true,

Default: stringdefault.StaticString("default"),
},
"resource_version": schema.StringAttribute{
MarkdownDescription: `An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources.
Expand All @@ -85,6 +90,7 @@ Populated by the system. Read-only. More info: https://kubernetes.io/docs/concep
"spec": schema.SingleNestedAttribute{
MarkdownDescription: `Specification of the desired behavior of a job. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status`,
Required: true,

PlanModifiers: []planmodifier.Object{
objectplanmodifier.RequiresReplace(),
},
Expand Down
5 changes: 5 additions & 0 deletions internal/framework/provider/corev1/config_map_schema_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/types"
)
Expand Down Expand Up @@ -69,6 +70,7 @@ Applied only if Name is not specified. More info: https://git.k8s.io/community/c
MarkdownDescription: `Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names`,
Optional: true,
Computed: true,

PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
Expand All @@ -78,6 +80,9 @@ Applied only if Name is not specified. More info: https://git.k8s.io/community/c

Must be a DNS_LABEL. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces`,
Optional: true,
Computed: true,

Default: stringdefault.StaticString("default"),
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ resource "kubernetes_config_map_v1_gen" {
generate {
schema = true
model = true
autocrud = true
autocrud = true
}

ignored_attributes = [
Expand All @@ -41,6 +41,7 @@ resource "kubernetes_config_map_v1_gen" {
"metadata.resource_version",
"metadata.generation",
"metadata.name",
"metadata.namespace"
]

immutable_attributes = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ resource "kubernetes_namespace_v1_gen" {
"metadata.resource_version",
"metadata.generation",
"metadata.name",
"metadata.namespace"
]

immutable_attributes = [
Expand Down
1 change: 1 addition & 0 deletions internal/framework/provider/corev1/generate_secret.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ resource "kubernetes_secret_v1_gen" {
"metadata.resource_version",
"metadata.generation",
"metadata.name",
"metadata.namespace"
]

sensitive_attributes = [
Expand Down
1 change: 1 addition & 0 deletions internal/framework/provider/corev1/generate_service.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ resource "kubernetes_service_v1_gen" {
"metadata.resource_version",
"metadata.generation",
"metadata.name",
"metadata.namespace"
]

immutable_attributes = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ resource "kubernetes_service_account_v1_gen" {
"metadata.resource_version",
"metadata.generation",
"metadata.name",
"metadata.namespace"
]

immutable_attributes = [
Expand Down
5 changes: 5 additions & 0 deletions internal/framework/provider/corev1/namespace_schema_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/types"
)
Expand Down Expand Up @@ -59,6 +60,7 @@ Applied only if Name is not specified. More info: https://git.k8s.io/community/c
MarkdownDescription: `Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names`,
Optional: true,
Computed: true,

PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
Expand All @@ -68,6 +70,9 @@ Applied only if Name is not specified. More info: https://git.k8s.io/community/c

Must be a DNS_LABEL. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces`,
Optional: true,
Computed: true,

Default: stringdefault.StaticString("default"),
},
"resource_version": schema.StringAttribute{
MarkdownDescription: `An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources.
Expand Down
8 changes: 7 additions & 1 deletion internal/framework/provider/corev1/secret_schema_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/types"
)
Expand All @@ -27,7 +28,8 @@ func (r *Secret) Schema(ctx context.Context, req resource.SchemaRequest, resp *r
MarkdownDescription: `Data contains the secret data. Each key must consist of alphanumeric characters, '-', '_' or '.'. The serialized form of the secret data is a base64 encoded string, representing the arbitrary (possibly non-string) data value here. Described in https://tools.ietf.org/html/rfc4648#section-4`,
ElementType: types.StringType,
Optional: true,
Sensitive: true,

Sensitive: true,
},
"immutable": schema.BoolAttribute{
MarkdownDescription: `Immutable, if set to true, ensures that data stored in the Secret cannot be updated (only object metadata can be modified). If not set to true, the field can be modified at any time. Defaulted to nil.`,
Expand Down Expand Up @@ -65,6 +67,7 @@ Applied only if Name is not specified. More info: https://git.k8s.io/community/c
MarkdownDescription: `Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names`,
Optional: true,
Computed: true,

PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
Expand All @@ -74,6 +77,9 @@ Applied only if Name is not specified. More info: https://git.k8s.io/community/c

Must be a DNS_LABEL. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces`,
Optional: true,
Computed: true,

Default: stringdefault.StaticString("default"),
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Applied only if Name is not specified. More info: https://git.k8s.io/community/c
MarkdownDescription: `Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names`,
Optional: true,
Computed: true,

PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
Expand All @@ -81,6 +82,8 @@ Applied only if Name is not specified. More info: https://git.k8s.io/community/c

Must be a DNS_LABEL. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces`,
Optional: true,
Computed: true,

PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
Expand Down
Loading
Loading