From 4bf6bb5deb81e4b45044a0980fe82cf8a6f6eb52 Mon Sep 17 00:00:00 2001 From: Nick Schuch Date: Tue, 22 Jun 2021 15:19:34 +1000 Subject: [PATCH] Move resources to own package. Create data source: k8s_apps_v1_deployment_image --- .../apps/v1/deployment/image/read.go | 53 ++++++++++++ .../apps/v1/deployment/image/source.go | 48 +++++++++++ internal/datasources/datasources.go | 19 ++++ .../core/v1/pod/container/hostalias/expand.go | 30 ------- .../core/v1/pod/container/hostalias/fields.go | 33 ------- .../v1/pod/container/hostalias/flatten.go | 28 ------ .../container/hostalias/hostname/expand.go | 12 --- .../container/hostalias/hostname/fields.go | 17 ---- internal/kubernetes/core/v1/service/source.go | 43 ---------- .../apiextensions/v1beta1/crd/create.go | 0 .../apiextensions/v1beta1/crd/delete.go | 0 .../apiextensions/v1beta1/crd/generate.go | 2 +- .../apiextensions/v1beta1/crd/names/expand.go | 0 .../apiextensions/v1beta1/crd/names/fields.go | 0 .../v1beta1/crd/names/flatten.go | 0 .../apiextensions/v1beta1/crd/read.go | 2 +- .../apiextensions/v1beta1/crd/resource.go | 2 +- .../apiextensions/v1beta1/crd/update.go | 0 .../v1beta1/apiservice/create.go | 0 .../v1beta1/apiservice/delete.go | 0 .../v1beta1/apiservice/generate.go | 0 .../v1beta1/apiservice/read.go | 0 .../v1beta1/apiservice/resource.go | 0 .../v1beta1/apiservice/update.go | 0 .../apps/v1/daemonset/create.go | 0 .../apps/v1/daemonset/delete.go | 0 .../apps/v1/daemonset/generate.go | 2 +- .../apps/v1/daemonset/read.go | 2 +- .../apps/v1/daemonset/resource.go | 2 +- .../apps/v1/daemonset/update.go | 0 .../apps/v1/deployment/create.go | 0 .../apps/v1/deployment/delete.go | 0 .../apps/v1/deployment/generate.go | 2 +- .../apps/v1/deployment/read.go | 2 +- .../apps/v1/deployment/resource.go | 2 +- .../apps/v1/deployment/update.go | 0 .../apps/v1/statefulset/create.go | 0 .../apps/v1/statefulset/delete.go | 0 .../apps/v1/statefulset/generate.go | 2 +- .../apps/v1/statefulset/read.go | 2 +- .../apps/v1/statefulset/resource.go | 2 +- .../apps/v1/statefulset/update.go | 0 .../core/v1/configmap/create.go | 0 .../core/v1/configmap/delete.go | 0 .../core/v1/configmap/generate.go | 0 .../core/v1/configmap/read.go | 0 .../core/v1/configmap/resource.go | 0 .../core/v1/configmap/update.go | 0 .../core/v1/namespace/create.go | 0 .../core/v1/namespace/delete.go | 0 .../core/v1/namespace/generate.go | 0 .../core/v1/namespace/read.go | 0 .../core/v1/namespace/resource.go | 0 .../core/v1/namespace/update.go | 0 .../core/v1/pod/container/args/expand.go | 0 .../core/v1/pod/container/args/fields.go | 0 .../core/v1/pod/container/command/expand.go | 0 .../core/v1/pod/container/command/fields.go | 0 .../core/v1/pod/container/envvar/expand.go | 0 .../core/v1/pod/container/envvar/fields.go | 0 .../core/v1/pod/container/envvar/flatten.go | 0 .../core/v1/pod/container/expand.go | 16 ++-- .../core/v1/pod/container/fields.go | 16 ++-- .../core/v1/pod/container/flatten.go | 12 +-- .../v1/pod/container/handler/exec/expand.go | 2 +- .../v1/pod/container/handler/exec/fields.go | 2 +- .../v1/pod/container/handler/exec/flatten.go | 0 .../core/v1/pod/container/handler/expand.go | 6 +- .../core/v1/pod/container/handler/fields.go | 6 +- .../core/v1/pod/container/handler/flatten.go | 6 +- .../v1/pod/container/handler/http/expand.go | 0 .../v1/pod/container/handler/http/fields.go | 0 .../v1/pod/container/handler/http/flatten.go | 0 .../v1/pod/container/handler/tcp/expand.go | 0 .../v1/pod/container/handler/tcp/fields.go | 0 .../v1/pod/container/handler/tcp/flatten.go | 0 .../core/v1/pod/container/lifecycle/expand.go | 2 +- .../core/v1/pod/container/lifecycle/fields.go | 2 +- .../v1/pod/container/lifecycle/flatten.go | 2 +- .../core/v1/pod/container/mount/expand.go | 0 .../core/v1/pod/container/mount/fields.go | 0 .../core/v1/pod/container/mount/flatten.go | 0 .../core/v1/pod/container/port/expand.go | 0 .../core/v1/pod/container/port/fields.go | 0 .../core/v1/pod/container/port/flatten.go | 0 .../core/v1/pod/container/probe/expand.go | 6 +- .../core/v1/pod/container/probe/fields.go | 6 +- .../core/v1/pod/container/probe/flatten.go | 6 +- .../core/v1/pod/container/resource/expand.go | 0 .../core/v1/pod/container/resource/fields.go | 0 .../core/v1/pod/container/resource/flatten.go | 0 .../core/v1/pod/expand.go | 4 +- .../core/v1/pod/fields.go | 4 +- .../core/v1/pod/flatten.go | 4 +- .../core/v1/pod/volume/expand.go | 0 .../core/v1/pod/volume/fields.go | 0 .../core/v1/pod/volume/flatten.go | 0 .../core/v1/secret/create.go | 0 .../core/v1/secret/data/expand.go | 0 .../core/v1/secret/data/fields.go | 0 .../core/v1/secret/delete.go | 0 .../core/v1/secret/generate.go | 2 +- .../core/v1/secret/read.go | 0 .../core/v1/secret/resource.go | 2 +- .../core/v1/secret/update.go | 0 .../core/v1/service/create.go | 0 .../core/v1/service/delete.go | 0 .../core/v1/service/generate.go | 2 +- .../core/v1/service/ingress/expand.go | 0 .../core/v1/service/ingress/fields.go | 0 .../core/v1/service/ingress/flatten.go | 0 .../core/v1/service/port/expand.go | 0 .../core/v1/service/port/fields.go | 0 .../core/v1/service/port/flatten.go | 0 .../core/v1/service/read.go | 4 +- .../core/v1/service/resource.go | 4 +- .../core/v1/service/update.go | 0 .../core/v1/serviceaccount/create.go | 0 .../core/v1/serviceaccount/delete.go | 0 .../core/v1/serviceaccount/generate.go | 0 .../core/v1/serviceaccount/read.go | 0 .../core/v1/serviceaccount/resource.go | 0 .../core/v1/serviceaccount/update.go | 0 .../v1beta1/poddisruptionbudget/create.go | 0 .../v1beta1/poddisruptionbudget/delete.go | 0 .../v1beta1/poddisruptionbudget/generate.go | 0 .../v1beta1/poddisruptionbudget/read.go | 0 .../v1beta1/poddisruptionbudget/resource.go | 0 .../v1beta1/poddisruptionbudget/update.go | 0 .../rbac/v1/clusterrole/create.go | 0 .../rbac/v1/clusterrole/delete.go | 0 .../rbac/v1/clusterrole/generate.go | 2 +- .../rbac/v1/clusterrole/read.go | 2 +- .../rbac/v1/clusterrole/resource.go | 2 +- .../rbac/v1/clusterrole/update.go | 0 .../rbac/v1/clusterrolebinding/create.go | 0 .../rbac/v1/clusterrolebinding/delete.go | 0 .../rbac/v1/clusterrolebinding/generate.go | 2 +- .../rbac/v1/clusterrolebinding/read.go | 2 +- .../rbac/v1/clusterrolebinding/resource.go | 2 +- .../rbac/v1/clusterrolebinding/update.go | 0 .../rbac/v1/role/create.go | 0 .../rbac/v1/role/delete.go | 0 .../rbac/v1/role/generate.go | 2 +- .../rbac/v1/role/read.go | 2 +- .../rbac/v1/role/resource.go | 2 +- .../rbac/v1/role/rule/apigroups/expand.go | 0 .../rbac/v1/role/rule/apigroups/fields.go | 0 .../rbac/v1/role/rule/apigroups/flatten.go | 0 .../rbac/v1/role/rule/expand.go | 8 +- .../rbac/v1/role/rule/fields.go | 8 +- .../rbac/v1/role/rule/flatten.go | 0 .../rbac/v1/role/rule/resourcenames/expand.go | 0 .../rbac/v1/role/rule/resourcenames/fields.go | 0 .../rbac/v1/role/rule/resources/expand.go | 0 .../rbac/v1/role/rule/resources/fields.go | 0 .../rbac/v1/role/rule/verbs/expand.go | 0 .../rbac/v1/role/rule/verbs/fields.go | 0 .../rbac/v1/role/update.go | 0 .../rbac/v1/rolebinding/create.go | 0 .../rbac/v1/rolebinding/delete.go | 0 .../rbac/v1/rolebinding/generate.go | 2 +- .../rbac/v1/rolebinding/read.go | 2 +- .../rbac/v1/rolebinding/resource.go | 2 +- .../rbac/v1/rolebinding/subject/expand.go | 0 .../rbac/v1/rolebinding/subject/fields.go | 0 .../rbac/v1/rolebinding/subject/flatten.go | 0 .../rbac/v1/rolebinding/update.go | 0 internal/resources/resources.go | 84 ++++++++++++++++++ .../storage/v1/storageclass/create.go | 0 .../storage/v1/storageclass/delete.go | 0 .../storage/v1/storageclass/generate.go | 0 .../storage/v1/storageclass/read.go | 0 .../storage/v1/storageclass/resource.go | 0 .../storage/v1/storageclass/update.go | 0 provider.go | 86 ++----------------- 176 files changed, 300 insertions(+), 333 deletions(-) create mode 100644 internal/datasources/apps/v1/deployment/image/read.go create mode 100644 internal/datasources/apps/v1/deployment/image/source.go create mode 100644 internal/datasources/datasources.go delete mode 100644 internal/kubernetes/core/v1/pod/container/hostalias/expand.go delete mode 100644 internal/kubernetes/core/v1/pod/container/hostalias/fields.go delete mode 100644 internal/kubernetes/core/v1/pod/container/hostalias/flatten.go delete mode 100644 internal/kubernetes/core/v1/pod/container/hostalias/hostname/expand.go delete mode 100644 internal/kubernetes/core/v1/pod/container/hostalias/hostname/fields.go delete mode 100644 internal/kubernetes/core/v1/service/source.go rename internal/{kubernetes => resources}/apiextensions/v1beta1/crd/create.go (100%) rename internal/{kubernetes => resources}/apiextensions/v1beta1/crd/delete.go (100%) rename internal/{kubernetes => resources}/apiextensions/v1beta1/crd/generate.go (92%) rename internal/{kubernetes => resources}/apiextensions/v1beta1/crd/names/expand.go (100%) rename internal/{kubernetes => resources}/apiextensions/v1beta1/crd/names/fields.go (100%) rename internal/{kubernetes => resources}/apiextensions/v1beta1/crd/names/flatten.go (100%) rename internal/{kubernetes => resources}/apiextensions/v1beta1/crd/read.go (92%) rename internal/{kubernetes => resources}/apiextensions/v1beta1/crd/resource.go (92%) rename internal/{kubernetes => resources}/apiextensions/v1beta1/crd/update.go (100%) rename internal/{kubernetes => resources}/apiregistration/v1beta1/apiservice/create.go (100%) rename internal/{kubernetes => resources}/apiregistration/v1beta1/apiservice/delete.go (100%) rename internal/{kubernetes => resources}/apiregistration/v1beta1/apiservice/generate.go (100%) rename internal/{kubernetes => resources}/apiregistration/v1beta1/apiservice/read.go (100%) rename internal/{kubernetes => resources}/apiregistration/v1beta1/apiservice/resource.go (100%) rename internal/{kubernetes => resources}/apiregistration/v1beta1/apiservice/update.go (100%) rename internal/{kubernetes => resources}/apps/v1/daemonset/create.go (100%) rename internal/{kubernetes => resources}/apps/v1/daemonset/delete.go (100%) rename internal/{kubernetes => resources}/apps/v1/daemonset/generate.go (93%) rename internal/{kubernetes => resources}/apps/v1/daemonset/read.go (93%) rename internal/{kubernetes => resources}/apps/v1/daemonset/resource.go (92%) rename internal/{kubernetes => resources}/apps/v1/daemonset/update.go (100%) rename internal/{kubernetes => resources}/apps/v1/deployment/create.go (100%) rename internal/{kubernetes => resources}/apps/v1/deployment/delete.go (100%) rename internal/{kubernetes => resources}/apps/v1/deployment/generate.go (93%) rename internal/{kubernetes => resources}/apps/v1/deployment/read.go (93%) rename internal/{kubernetes => resources}/apps/v1/deployment/resource.go (93%) rename internal/{kubernetes => resources}/apps/v1/deployment/update.go (100%) rename internal/{kubernetes => resources}/apps/v1/statefulset/create.go (100%) rename internal/{kubernetes => resources}/apps/v1/statefulset/delete.go (100%) rename internal/{kubernetes => resources}/apps/v1/statefulset/generate.go (93%) rename internal/{kubernetes => resources}/apps/v1/statefulset/read.go (93%) rename internal/{kubernetes => resources}/apps/v1/statefulset/resource.go (93%) rename internal/{kubernetes => resources}/apps/v1/statefulset/update.go (100%) rename internal/{kubernetes => resources}/core/v1/configmap/create.go (100%) rename internal/{kubernetes => resources}/core/v1/configmap/delete.go (100%) rename internal/{kubernetes => resources}/core/v1/configmap/generate.go (100%) rename internal/{kubernetes => resources}/core/v1/configmap/read.go (100%) rename internal/{kubernetes => resources}/core/v1/configmap/resource.go (100%) rename internal/{kubernetes => resources}/core/v1/configmap/update.go (100%) rename internal/{kubernetes => resources}/core/v1/namespace/create.go (100%) rename internal/{kubernetes => resources}/core/v1/namespace/delete.go (100%) rename internal/{kubernetes => resources}/core/v1/namespace/generate.go (100%) rename internal/{kubernetes => resources}/core/v1/namespace/read.go (100%) rename internal/{kubernetes => resources}/core/v1/namespace/resource.go (100%) rename internal/{kubernetes => resources}/core/v1/namespace/update.go (100%) rename internal/{kubernetes => resources}/core/v1/pod/container/args/expand.go (100%) rename internal/{kubernetes => resources}/core/v1/pod/container/args/fields.go (100%) rename internal/{kubernetes => resources}/core/v1/pod/container/command/expand.go (100%) rename internal/{kubernetes => resources}/core/v1/pod/container/command/fields.go (100%) rename internal/{kubernetes => resources}/core/v1/pod/container/envvar/expand.go (100%) rename internal/{kubernetes => resources}/core/v1/pod/container/envvar/fields.go (100%) rename internal/{kubernetes => resources}/core/v1/pod/container/envvar/flatten.go (100%) rename internal/{kubernetes => resources}/core/v1/pod/container/expand.go (74%) rename internal/{kubernetes => resources}/core/v1/pod/container/fields.go (71%) rename internal/{kubernetes => resources}/core/v1/pod/container/flatten.go (71%) rename internal/{kubernetes => resources}/core/v1/pod/container/handler/exec/expand.go (78%) rename internal/{kubernetes => resources}/core/v1/pod/container/handler/exec/fields.go (83%) rename internal/{kubernetes => resources}/core/v1/pod/container/handler/exec/flatten.go (100%) rename internal/{kubernetes => resources}/core/v1/pod/container/handler/expand.go (64%) rename internal/{kubernetes => resources}/core/v1/pod/container/handler/fields.go (69%) rename internal/{kubernetes => resources}/core/v1/pod/container/handler/flatten.go (59%) rename internal/{kubernetes => resources}/core/v1/pod/container/handler/http/expand.go (100%) rename internal/{kubernetes => resources}/core/v1/pod/container/handler/http/fields.go (100%) rename internal/{kubernetes => resources}/core/v1/pod/container/handler/http/flatten.go (100%) rename internal/{kubernetes => resources}/core/v1/pod/container/handler/tcp/expand.go (100%) rename internal/{kubernetes => resources}/core/v1/pod/container/handler/tcp/fields.go (100%) rename internal/{kubernetes => resources}/core/v1/pod/container/handler/tcp/flatten.go (100%) rename internal/{kubernetes => resources}/core/v1/pod/container/lifecycle/expand.go (83%) rename internal/{kubernetes => resources}/core/v1/pod/container/lifecycle/fields.go (85%) rename internal/{kubernetes => resources}/core/v1/pod/container/lifecycle/flatten.go (80%) rename internal/{kubernetes => resources}/core/v1/pod/container/mount/expand.go (100%) rename internal/{kubernetes => resources}/core/v1/pod/container/mount/fields.go (100%) rename internal/{kubernetes => resources}/core/v1/pod/container/mount/flatten.go (100%) rename internal/{kubernetes => resources}/core/v1/pod/container/port/expand.go (100%) rename internal/{kubernetes => resources}/core/v1/pod/container/port/fields.go (100%) rename internal/{kubernetes => resources}/core/v1/pod/container/port/flatten.go (100%) rename internal/{kubernetes => resources}/core/v1/pod/container/probe/expand.go (77%) rename internal/{kubernetes => resources}/core/v1/pod/container/probe/fields.go (88%) rename internal/{kubernetes => resources}/core/v1/pod/container/probe/flatten.go (73%) rename internal/{kubernetes => resources}/core/v1/pod/container/resource/expand.go (100%) rename internal/{kubernetes => resources}/core/v1/pod/container/resource/fields.go (100%) rename internal/{kubernetes => resources}/core/v1/pod/container/resource/flatten.go (100%) rename internal/{kubernetes => resources}/core/v1/pod/expand.go (92%) rename internal/{kubernetes => resources}/core/v1/pod/fields.go (91%) rename internal/{kubernetes => resources}/core/v1/pod/flatten.go (87%) rename internal/{kubernetes => resources}/core/v1/pod/volume/expand.go (100%) rename internal/{kubernetes => resources}/core/v1/pod/volume/fields.go (100%) rename internal/{kubernetes => resources}/core/v1/pod/volume/flatten.go (100%) rename internal/{kubernetes => resources}/core/v1/secret/create.go (100%) rename internal/{kubernetes => resources}/core/v1/secret/data/expand.go (100%) rename internal/{kubernetes => resources}/core/v1/secret/data/fields.go (100%) rename internal/{kubernetes => resources}/core/v1/secret/delete.go (100%) rename internal/{kubernetes => resources}/core/v1/secret/generate.go (90%) rename internal/{kubernetes => resources}/core/v1/secret/read.go (100%) rename internal/{kubernetes => resources}/core/v1/secret/resource.go (91%) rename internal/{kubernetes => resources}/core/v1/secret/update.go (100%) rename internal/{kubernetes => resources}/core/v1/service/create.go (100%) rename internal/{kubernetes => resources}/core/v1/service/delete.go (100%) rename internal/{kubernetes => resources}/core/v1/service/generate.go (92%) rename internal/{kubernetes => resources}/core/v1/service/ingress/expand.go (100%) rename internal/{kubernetes => resources}/core/v1/service/ingress/fields.go (100%) rename internal/{kubernetes => resources}/core/v1/service/ingress/flatten.go (100%) rename internal/{kubernetes => resources}/core/v1/service/port/expand.go (100%) rename internal/{kubernetes => resources}/core/v1/service/port/fields.go (100%) rename internal/{kubernetes => resources}/core/v1/service/port/flatten.go (100%) rename internal/{kubernetes => resources}/core/v1/service/read.go (87%) rename internal/{kubernetes => resources}/core/v1/service/resource.go (88%) rename internal/{kubernetes => resources}/core/v1/service/update.go (100%) rename internal/{kubernetes => resources}/core/v1/serviceaccount/create.go (100%) rename internal/{kubernetes => resources}/core/v1/serviceaccount/delete.go (100%) rename internal/{kubernetes => resources}/core/v1/serviceaccount/generate.go (100%) rename internal/{kubernetes => resources}/core/v1/serviceaccount/read.go (100%) rename internal/{kubernetes => resources}/core/v1/serviceaccount/resource.go (100%) rename internal/{kubernetes => resources}/core/v1/serviceaccount/update.go (100%) rename internal/{kubernetes => resources}/policy/v1beta1/poddisruptionbudget/create.go (100%) rename internal/{kubernetes => resources}/policy/v1beta1/poddisruptionbudget/delete.go (100%) rename internal/{kubernetes => resources}/policy/v1beta1/poddisruptionbudget/generate.go (100%) rename internal/{kubernetes => resources}/policy/v1beta1/poddisruptionbudget/read.go (100%) rename internal/{kubernetes => resources}/policy/v1beta1/poddisruptionbudget/resource.go (100%) rename internal/{kubernetes => resources}/policy/v1beta1/poddisruptionbudget/update.go (100%) rename internal/{kubernetes => resources}/rbac/v1/clusterrole/create.go (100%) rename internal/{kubernetes => resources}/rbac/v1/clusterrole/delete.go (100%) rename internal/{kubernetes => resources}/rbac/v1/clusterrole/generate.go (88%) rename internal/{kubernetes => resources}/rbac/v1/clusterrole/read.go (91%) rename internal/{kubernetes => resources}/rbac/v1/clusterrole/resource.go (88%) rename internal/{kubernetes => resources}/rbac/v1/clusterrole/update.go (100%) rename internal/{kubernetes => resources}/rbac/v1/clusterrolebinding/create.go (100%) rename internal/{kubernetes => resources}/rbac/v1/clusterrolebinding/delete.go (100%) rename internal/{kubernetes => resources}/rbac/v1/clusterrolebinding/generate.go (90%) rename internal/{kubernetes => resources}/rbac/v1/clusterrolebinding/read.go (92%) rename internal/{kubernetes => resources}/rbac/v1/clusterrolebinding/resource.go (92%) rename internal/{kubernetes => resources}/rbac/v1/clusterrolebinding/update.go (100%) rename internal/{kubernetes => resources}/rbac/v1/role/create.go (100%) rename internal/{kubernetes => resources}/rbac/v1/role/delete.go (100%) rename internal/{kubernetes => resources}/rbac/v1/role/generate.go (89%) rename internal/{kubernetes => resources}/rbac/v1/role/read.go (92%) rename internal/{kubernetes => resources}/rbac/v1/role/resource.go (91%) rename internal/{kubernetes => resources}/rbac/v1/role/rule/apigroups/expand.go (100%) rename internal/{kubernetes => resources}/rbac/v1/role/rule/apigroups/fields.go (100%) rename internal/{kubernetes => resources}/rbac/v1/role/rule/apigroups/flatten.go (100%) rename internal/{kubernetes => resources}/rbac/v1/role/rule/expand.go (73%) rename internal/{kubernetes => resources}/rbac/v1/role/rule/fields.go (75%) rename internal/{kubernetes => resources}/rbac/v1/role/rule/flatten.go (100%) rename internal/{kubernetes => resources}/rbac/v1/role/rule/resourcenames/expand.go (100%) rename internal/{kubernetes => resources}/rbac/v1/role/rule/resourcenames/fields.go (100%) rename internal/{kubernetes => resources}/rbac/v1/role/rule/resources/expand.go (100%) rename internal/{kubernetes => resources}/rbac/v1/role/rule/resources/fields.go (100%) rename internal/{kubernetes => resources}/rbac/v1/role/rule/verbs/expand.go (100%) rename internal/{kubernetes => resources}/rbac/v1/role/rule/verbs/fields.go (100%) rename internal/{kubernetes => resources}/rbac/v1/role/update.go (100%) rename internal/{kubernetes => resources}/rbac/v1/rolebinding/create.go (100%) rename internal/{kubernetes => resources}/rbac/v1/rolebinding/delete.go (100%) rename internal/{kubernetes => resources}/rbac/v1/rolebinding/generate.go (91%) rename internal/{kubernetes => resources}/rbac/v1/rolebinding/read.go (92%) rename internal/{kubernetes => resources}/rbac/v1/rolebinding/resource.go (93%) rename internal/{kubernetes => resources}/rbac/v1/rolebinding/subject/expand.go (100%) rename internal/{kubernetes => resources}/rbac/v1/rolebinding/subject/fields.go (100%) rename internal/{kubernetes => resources}/rbac/v1/rolebinding/subject/flatten.go (100%) rename internal/{kubernetes => resources}/rbac/v1/rolebinding/update.go (100%) create mode 100644 internal/resources/resources.go rename internal/{kubernetes => resources}/storage/v1/storageclass/create.go (100%) rename internal/{kubernetes => resources}/storage/v1/storageclass/delete.go (100%) rename internal/{kubernetes => resources}/storage/v1/storageclass/generate.go (100%) rename internal/{kubernetes => resources}/storage/v1/storageclass/read.go (100%) rename internal/{kubernetes => resources}/storage/v1/storageclass/resource.go (100%) rename internal/{kubernetes => resources}/storage/v1/storageclass/update.go (100%) diff --git a/internal/datasources/apps/v1/deployment/image/read.go b/internal/datasources/apps/v1/deployment/image/read.go new file mode 100644 index 00000000..63e06208 --- /dev/null +++ b/internal/datasources/apps/v1/deployment/image/read.go @@ -0,0 +1,53 @@ +package image + +import ( + "github.com/hashicorp/terraform/helper/schema" + "github.com/pkg/errors" + corev1 "k8s.io/api/core/v1" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/previousnext/terraform-provider-k8s/internal/terraform/config" + "github.com/previousnext/terraform-provider-k8s/internal/terraform/id" +) + +// Read the Deployment. +func Read(d *schema.ResourceData, m interface{}) error { + conn := m.(*config.Client) + + var ( + namespace = d.Get(FieldNamespace).(string) + name = d.Get(FieldName).(string) + container = d.Get(FieldContainer).(string) + fallback = d.Get(FieldFallback).(string) + ) + + d.SetId(id.Join(metav1.ObjectMeta{ + Namespace: namespace, + Name: name, + })) + + deployment, err := conn.Kubernetes().AppsV1().Deployments(namespace).Get(name, metav1.GetOptions{}) + if kerrors.IsNotFound(err) { + d.Set(FieldResult, fallback) + return nil + } else if err != nil { + return errors.Wrap(err, "failed to get") + } + + getImage := func(containers []corev1.Container, name, fallback string) string { + for _, c := range deployment.Spec.Template.Spec.Containers { + if c.Name == container { + return c.Image + } + } + + return fallback + } + + result := getImage(deployment.Spec.Template.Spec.Containers, container, fallback) + + d.Set(FieldResult, result) + + return nil +} diff --git a/internal/datasources/apps/v1/deployment/image/source.go b/internal/datasources/apps/v1/deployment/image/source.go new file mode 100644 index 00000000..beebcf86 --- /dev/null +++ b/internal/datasources/apps/v1/deployment/image/source.go @@ -0,0 +1,48 @@ +package image + +import ( + "github.com/hashicorp/terraform/helper/schema" +) + +const ( + // FieldName is a field identifier. + FieldName = "name" + // FieldNamespace is a field identifier. + FieldNamespace = "namespace" + // FieldContainer is a field identifier. + FieldContainer = "container" + // FieldFallback is a field identifier. + FieldFallback = "fallback" + // FieldResult is a field identifier. + FieldResult = "result" +) + +// Source returns this packages data source. +func Source() *schema.Resource { + return &schema.Resource{ + Read: Read, + + Schema: map[string]*schema.Schema{ + FieldName: { + Type: schema.TypeString, + Required: true, + }, + FieldNamespace: { + Type: schema.TypeString, + Required: true, + }, + FieldContainer: { + Type: schema.TypeString, + Required: true, + }, + FieldFallback: { + Type: schema.TypeString, + Required: true, + }, + FieldResult: { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} diff --git a/internal/datasources/datasources.go b/internal/datasources/datasources.go new file mode 100644 index 00000000..8968ce36 --- /dev/null +++ b/internal/datasources/datasources.go @@ -0,0 +1,19 @@ +package datasources + +import ( + "github.com/hashicorp/terraform/helper/schema" + + deploymentimage "github.com/previousnext/terraform-provider-k8s/internal/datasources/apps/v1/deployment/image" +) + +const ( + // FieldDeploymentImage identifier for the Kubernetes Deployment. + FieldDeploymentImage = "k8s_apps_v1_deployment_image" +) + +// DataSourcesMap returns a list of data sources. +func DataSourcesMap() map[string]*schema.Resource { + return map[string]*schema.Resource{ + FieldDeploymentImage: deploymentimage.Source(), + } +} diff --git a/internal/kubernetes/core/v1/pod/container/hostalias/expand.go b/internal/kubernetes/core/v1/pod/container/hostalias/expand.go deleted file mode 100644 index 85496f8d..00000000 --- a/internal/kubernetes/core/v1/pod/container/hostalias/expand.go +++ /dev/null @@ -1,30 +0,0 @@ -package hostalias - -import ( - corev1 "k8s.io/api/core/v1" - - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/hostalias/hostname" -) - -// Expand will return a structured object. -func Expand(in []interface{}) []corev1.HostAlias { - if len(in) == 0 { - return []corev1.HostAlias{} - } - - aliases := make([]corev1.HostAlias, len(in)) - - for key, v := range in { - value := v.(map[string]interface{}) - - if ip, ok := value[FieldIP]; ok && ip != "" { - aliases[key].IP = ip.(string) - } - - if hosts, ok := value[hostname.Field]; ok { - aliases[key].Hostnames = hostname.Expand(hosts.([]interface{})) - } - } - - return aliases -} diff --git a/internal/kubernetes/core/v1/pod/container/hostalias/fields.go b/internal/kubernetes/core/v1/pod/container/hostalias/fields.go deleted file mode 100644 index 6672e3db..00000000 --- a/internal/kubernetes/core/v1/pod/container/hostalias/fields.go +++ /dev/null @@ -1,33 +0,0 @@ -package hostalias - -import ( - "github.com/hashicorp/terraform/helper/schema" - - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/hostalias/hostname" -) - -const ( - // FieldIP is used to identify the IP field. - FieldIP = "ip" - // FieldHostname is used to identify the hostname field. - FieldHostname = "hostname" -) - -// Fields returns the fields for this package. -func Fields() *schema.Schema { - return &schema.Schema{ - Description: "Environment variables which can be set for a container", - Type: schema.TypeList, - Optional: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - FieldIP: { - Type: schema.TypeString, - Required: true, - Description: "IP Address of the host.", - }, - FieldHostname: hostname.Fields(), - }, - }, - } -} diff --git a/internal/kubernetes/core/v1/pod/container/hostalias/flatten.go b/internal/kubernetes/core/v1/pod/container/hostalias/flatten.go deleted file mode 100644 index b0296958..00000000 --- a/internal/kubernetes/core/v1/pod/container/hostalias/flatten.go +++ /dev/null @@ -1,28 +0,0 @@ -package hostalias - -import ( - corev1 "k8s.io/api/core/v1" - - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/hostalias/hostname" -) - -// Flatten structured object into unstructured. -func Flatten(in []corev1.HostAlias) []interface{} { - flattened := make([]interface{}, len(in)) - - for key, value := range in { - row := map[string]interface{}{} - - if value.IP != "" { - row[FieldIP] = value.IP - } - - if len(value.Hostnames) > 0 { - row[hostname.Field] = value.Hostnames - } - - flattened[key] = row - } - - return flattened -} diff --git a/internal/kubernetes/core/v1/pod/container/hostalias/hostname/expand.go b/internal/kubernetes/core/v1/pod/container/hostalias/hostname/expand.go deleted file mode 100644 index e161c705..00000000 --- a/internal/kubernetes/core/v1/pod/container/hostalias/hostname/expand.go +++ /dev/null @@ -1,12 +0,0 @@ -package hostname - -// Expand will return a structured object. -func Expand(s []interface{}) []string { - result := make([]string, len(s), len(s)) - - for k, v := range s { - result[k] = v.(string) - } - - return result -} diff --git a/internal/kubernetes/core/v1/pod/container/hostalias/hostname/fields.go b/internal/kubernetes/core/v1/pod/container/hostalias/hostname/fields.go deleted file mode 100644 index 36a65d29..00000000 --- a/internal/kubernetes/core/v1/pod/container/hostalias/hostname/fields.go +++ /dev/null @@ -1,17 +0,0 @@ -package hostname - -import ( - "github.com/hashicorp/terraform/helper/schema" -) - -// Fields returns the fields for this package. -func Fields() *schema.Schema { - return &schema.Schema{ - Description: "Hostname(s) to assign to an IP.", - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - } -} diff --git a/internal/kubernetes/core/v1/service/source.go b/internal/kubernetes/core/v1/service/source.go deleted file mode 100644 index 47981b3f..00000000 --- a/internal/kubernetes/core/v1/service/source.go +++ /dev/null @@ -1,43 +0,0 @@ -package service - -import ( - "github.com/hashicorp/terraform/helper/schema" - - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/service/ingress" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/service/port" -) - -// Source returns this packages data sources. -func Source() *schema.Resource { - return &schema.Resource{ - Read: Read, - - Schema: map[string]*schema.Schema{ - FieldName: &schema.Schema{ - Type: schema.TypeString, - Description: "Name of the object.", - Required: true, - }, - FieldNamespace: &schema.Schema{ - Type: schema.TypeString, - Description: "Namespace which the object will reside.", - Optional: true, - }, - FieldLabels: &schema.Schema{ - Type: schema.TypeMap, - Optional: true, - }, - FieldType: &schema.Schema{ - Type: schema.TypeString, - Description: "Type determines how the Service is exposed.", - Optional: true, - }, - FieldPort: port.Fields(), - FieldSelector: &schema.Schema{ - Type: schema.TypeMap, - Optional: true, - }, - FieldIngress: ingress.Fields(), - }, - } -} diff --git a/internal/kubernetes/apiextensions/v1beta1/crd/create.go b/internal/resources/apiextensions/v1beta1/crd/create.go similarity index 100% rename from internal/kubernetes/apiextensions/v1beta1/crd/create.go rename to internal/resources/apiextensions/v1beta1/crd/create.go diff --git a/internal/kubernetes/apiextensions/v1beta1/crd/delete.go b/internal/resources/apiextensions/v1beta1/crd/delete.go similarity index 100% rename from internal/kubernetes/apiextensions/v1beta1/crd/delete.go rename to internal/resources/apiextensions/v1beta1/crd/delete.go diff --git a/internal/kubernetes/apiextensions/v1beta1/crd/generate.go b/internal/resources/apiextensions/v1beta1/crd/generate.go similarity index 92% rename from internal/kubernetes/apiextensions/v1beta1/crd/generate.go rename to internal/resources/apiextensions/v1beta1/crd/generate.go index 539038e7..e4ddd668 100644 --- a/internal/kubernetes/apiextensions/v1beta1/crd/generate.go +++ b/internal/resources/apiextensions/v1beta1/crd/generate.go @@ -6,7 +6,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/previousnext/terraform-provider-k8s/internal/interfaceutils" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/apiextensions/v1beta1/crd/names" + "github.com/previousnext/terraform-provider-k8s/internal/resources/apiextensions/v1beta1/crd/names" ) // Generate the ServiceAccount. diff --git a/internal/kubernetes/apiextensions/v1beta1/crd/names/expand.go b/internal/resources/apiextensions/v1beta1/crd/names/expand.go similarity index 100% rename from internal/kubernetes/apiextensions/v1beta1/crd/names/expand.go rename to internal/resources/apiextensions/v1beta1/crd/names/expand.go diff --git a/internal/kubernetes/apiextensions/v1beta1/crd/names/fields.go b/internal/resources/apiextensions/v1beta1/crd/names/fields.go similarity index 100% rename from internal/kubernetes/apiextensions/v1beta1/crd/names/fields.go rename to internal/resources/apiextensions/v1beta1/crd/names/fields.go diff --git a/internal/kubernetes/apiextensions/v1beta1/crd/names/flatten.go b/internal/resources/apiextensions/v1beta1/crd/names/flatten.go similarity index 100% rename from internal/kubernetes/apiextensions/v1beta1/crd/names/flatten.go rename to internal/resources/apiextensions/v1beta1/crd/names/flatten.go diff --git a/internal/kubernetes/apiextensions/v1beta1/crd/read.go b/internal/resources/apiextensions/v1beta1/crd/read.go similarity index 92% rename from internal/kubernetes/apiextensions/v1beta1/crd/read.go rename to internal/resources/apiextensions/v1beta1/crd/read.go index 600a9485..72117bfa 100644 --- a/internal/kubernetes/apiextensions/v1beta1/crd/read.go +++ b/internal/resources/apiextensions/v1beta1/crd/read.go @@ -6,7 +6,7 @@ import ( kerrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/apiextensions/v1beta1/crd/names" + "github.com/previousnext/terraform-provider-k8s/internal/resources/apiextensions/v1beta1/crd/names" "github.com/previousnext/terraform-provider-k8s/internal/terraform/config" "github.com/previousnext/terraform-provider-k8s/internal/terraform/id" ) diff --git a/internal/kubernetes/apiextensions/v1beta1/crd/resource.go b/internal/resources/apiextensions/v1beta1/crd/resource.go similarity index 92% rename from internal/kubernetes/apiextensions/v1beta1/crd/resource.go rename to internal/resources/apiextensions/v1beta1/crd/resource.go index 50689c10..fc6270bc 100644 --- a/internal/kubernetes/apiextensions/v1beta1/crd/resource.go +++ b/internal/resources/apiextensions/v1beta1/crd/resource.go @@ -3,7 +3,7 @@ package crd import ( "github.com/hashicorp/terraform/helper/schema" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/apiextensions/v1beta1/crd/names" + "github.com/previousnext/terraform-provider-k8s/internal/resources/apiextensions/v1beta1/crd/names" ) const ( diff --git a/internal/kubernetes/apiextensions/v1beta1/crd/update.go b/internal/resources/apiextensions/v1beta1/crd/update.go similarity index 100% rename from internal/kubernetes/apiextensions/v1beta1/crd/update.go rename to internal/resources/apiextensions/v1beta1/crd/update.go diff --git a/internal/kubernetes/apiregistration/v1beta1/apiservice/create.go b/internal/resources/apiregistration/v1beta1/apiservice/create.go similarity index 100% rename from internal/kubernetes/apiregistration/v1beta1/apiservice/create.go rename to internal/resources/apiregistration/v1beta1/apiservice/create.go diff --git a/internal/kubernetes/apiregistration/v1beta1/apiservice/delete.go b/internal/resources/apiregistration/v1beta1/apiservice/delete.go similarity index 100% rename from internal/kubernetes/apiregistration/v1beta1/apiservice/delete.go rename to internal/resources/apiregistration/v1beta1/apiservice/delete.go diff --git a/internal/kubernetes/apiregistration/v1beta1/apiservice/generate.go b/internal/resources/apiregistration/v1beta1/apiservice/generate.go similarity index 100% rename from internal/kubernetes/apiregistration/v1beta1/apiservice/generate.go rename to internal/resources/apiregistration/v1beta1/apiservice/generate.go diff --git a/internal/kubernetes/apiregistration/v1beta1/apiservice/read.go b/internal/resources/apiregistration/v1beta1/apiservice/read.go similarity index 100% rename from internal/kubernetes/apiregistration/v1beta1/apiservice/read.go rename to internal/resources/apiregistration/v1beta1/apiservice/read.go diff --git a/internal/kubernetes/apiregistration/v1beta1/apiservice/resource.go b/internal/resources/apiregistration/v1beta1/apiservice/resource.go similarity index 100% rename from internal/kubernetes/apiregistration/v1beta1/apiservice/resource.go rename to internal/resources/apiregistration/v1beta1/apiservice/resource.go diff --git a/internal/kubernetes/apiregistration/v1beta1/apiservice/update.go b/internal/resources/apiregistration/v1beta1/apiservice/update.go similarity index 100% rename from internal/kubernetes/apiregistration/v1beta1/apiservice/update.go rename to internal/resources/apiregistration/v1beta1/apiservice/update.go diff --git a/internal/kubernetes/apps/v1/daemonset/create.go b/internal/resources/apps/v1/daemonset/create.go similarity index 100% rename from internal/kubernetes/apps/v1/daemonset/create.go rename to internal/resources/apps/v1/daemonset/create.go diff --git a/internal/kubernetes/apps/v1/daemonset/delete.go b/internal/resources/apps/v1/daemonset/delete.go similarity index 100% rename from internal/kubernetes/apps/v1/daemonset/delete.go rename to internal/resources/apps/v1/daemonset/delete.go diff --git a/internal/kubernetes/apps/v1/daemonset/generate.go b/internal/resources/apps/v1/daemonset/generate.go similarity index 93% rename from internal/kubernetes/apps/v1/daemonset/generate.go rename to internal/resources/apps/v1/daemonset/generate.go index 114bfcd3..170e8344 100644 --- a/internal/kubernetes/apps/v1/daemonset/generate.go +++ b/internal/resources/apps/v1/daemonset/generate.go @@ -7,7 +7,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/previousnext/terraform-provider-k8s/internal/interfaceutils" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod" ) // Generate the DaemonSet. diff --git a/internal/kubernetes/apps/v1/daemonset/read.go b/internal/resources/apps/v1/daemonset/read.go similarity index 93% rename from internal/kubernetes/apps/v1/daemonset/read.go rename to internal/resources/apps/v1/daemonset/read.go index 9007fb9c..ead1bfdd 100644 --- a/internal/kubernetes/apps/v1/daemonset/read.go +++ b/internal/resources/apps/v1/daemonset/read.go @@ -6,7 +6,7 @@ import ( kerrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod" "github.com/previousnext/terraform-provider-k8s/internal/terraform/config" "github.com/previousnext/terraform-provider-k8s/internal/terraform/id" ) diff --git a/internal/kubernetes/apps/v1/daemonset/resource.go b/internal/resources/apps/v1/daemonset/resource.go similarity index 92% rename from internal/kubernetes/apps/v1/daemonset/resource.go rename to internal/resources/apps/v1/daemonset/resource.go index 4d10b1f0..b8dfc33a 100644 --- a/internal/kubernetes/apps/v1/daemonset/resource.go +++ b/internal/resources/apps/v1/daemonset/resource.go @@ -3,7 +3,7 @@ package daemonset import ( "github.com/hashicorp/terraform/helper/schema" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod" ) const ( diff --git a/internal/kubernetes/apps/v1/daemonset/update.go b/internal/resources/apps/v1/daemonset/update.go similarity index 100% rename from internal/kubernetes/apps/v1/daemonset/update.go rename to internal/resources/apps/v1/daemonset/update.go diff --git a/internal/kubernetes/apps/v1/deployment/create.go b/internal/resources/apps/v1/deployment/create.go similarity index 100% rename from internal/kubernetes/apps/v1/deployment/create.go rename to internal/resources/apps/v1/deployment/create.go diff --git a/internal/kubernetes/apps/v1/deployment/delete.go b/internal/resources/apps/v1/deployment/delete.go similarity index 100% rename from internal/kubernetes/apps/v1/deployment/delete.go rename to internal/resources/apps/v1/deployment/delete.go diff --git a/internal/kubernetes/apps/v1/deployment/generate.go b/internal/resources/apps/v1/deployment/generate.go similarity index 93% rename from internal/kubernetes/apps/v1/deployment/generate.go rename to internal/resources/apps/v1/deployment/generate.go index 2568fde0..a2394622 100644 --- a/internal/kubernetes/apps/v1/deployment/generate.go +++ b/internal/resources/apps/v1/deployment/generate.go @@ -7,7 +7,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/previousnext/terraform-provider-k8s/internal/interfaceutils" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod" ) // Generate the Deployment. diff --git a/internal/kubernetes/apps/v1/deployment/read.go b/internal/resources/apps/v1/deployment/read.go similarity index 93% rename from internal/kubernetes/apps/v1/deployment/read.go rename to internal/resources/apps/v1/deployment/read.go index d979c466..53efbb44 100644 --- a/internal/kubernetes/apps/v1/deployment/read.go +++ b/internal/resources/apps/v1/deployment/read.go @@ -6,7 +6,7 @@ import ( kerrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod" "github.com/previousnext/terraform-provider-k8s/internal/terraform/config" "github.com/previousnext/terraform-provider-k8s/internal/terraform/id" ) diff --git a/internal/kubernetes/apps/v1/deployment/resource.go b/internal/resources/apps/v1/deployment/resource.go similarity index 93% rename from internal/kubernetes/apps/v1/deployment/resource.go rename to internal/resources/apps/v1/deployment/resource.go index 9ccfa9f6..14bfad84 100644 --- a/internal/kubernetes/apps/v1/deployment/resource.go +++ b/internal/resources/apps/v1/deployment/resource.go @@ -3,7 +3,7 @@ package deployment import ( "github.com/hashicorp/terraform/helper/schema" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod" ) const ( diff --git a/internal/kubernetes/apps/v1/deployment/update.go b/internal/resources/apps/v1/deployment/update.go similarity index 100% rename from internal/kubernetes/apps/v1/deployment/update.go rename to internal/resources/apps/v1/deployment/update.go diff --git a/internal/kubernetes/apps/v1/statefulset/create.go b/internal/resources/apps/v1/statefulset/create.go similarity index 100% rename from internal/kubernetes/apps/v1/statefulset/create.go rename to internal/resources/apps/v1/statefulset/create.go diff --git a/internal/kubernetes/apps/v1/statefulset/delete.go b/internal/resources/apps/v1/statefulset/delete.go similarity index 100% rename from internal/kubernetes/apps/v1/statefulset/delete.go rename to internal/resources/apps/v1/statefulset/delete.go diff --git a/internal/kubernetes/apps/v1/statefulset/generate.go b/internal/resources/apps/v1/statefulset/generate.go similarity index 93% rename from internal/kubernetes/apps/v1/statefulset/generate.go rename to internal/resources/apps/v1/statefulset/generate.go index f39e32d8..771a4526 100644 --- a/internal/kubernetes/apps/v1/statefulset/generate.go +++ b/internal/resources/apps/v1/statefulset/generate.go @@ -7,7 +7,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/previousnext/terraform-provider-k8s/internal/interfaceutils" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod" ) // Generate the StatefulSet. diff --git a/internal/kubernetes/apps/v1/statefulset/read.go b/internal/resources/apps/v1/statefulset/read.go similarity index 93% rename from internal/kubernetes/apps/v1/statefulset/read.go rename to internal/resources/apps/v1/statefulset/read.go index 893c1905..0d567837 100644 --- a/internal/kubernetes/apps/v1/statefulset/read.go +++ b/internal/resources/apps/v1/statefulset/read.go @@ -6,7 +6,7 @@ import ( kerrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod" "github.com/previousnext/terraform-provider-k8s/internal/terraform/config" "github.com/previousnext/terraform-provider-k8s/internal/terraform/id" ) diff --git a/internal/kubernetes/apps/v1/statefulset/resource.go b/internal/resources/apps/v1/statefulset/resource.go similarity index 93% rename from internal/kubernetes/apps/v1/statefulset/resource.go rename to internal/resources/apps/v1/statefulset/resource.go index d3cf6e00..de644ea9 100644 --- a/internal/kubernetes/apps/v1/statefulset/resource.go +++ b/internal/resources/apps/v1/statefulset/resource.go @@ -3,7 +3,7 @@ package statefulset import ( "github.com/hashicorp/terraform/helper/schema" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod" ) const ( diff --git a/internal/kubernetes/apps/v1/statefulset/update.go b/internal/resources/apps/v1/statefulset/update.go similarity index 100% rename from internal/kubernetes/apps/v1/statefulset/update.go rename to internal/resources/apps/v1/statefulset/update.go diff --git a/internal/kubernetes/core/v1/configmap/create.go b/internal/resources/core/v1/configmap/create.go similarity index 100% rename from internal/kubernetes/core/v1/configmap/create.go rename to internal/resources/core/v1/configmap/create.go diff --git a/internal/kubernetes/core/v1/configmap/delete.go b/internal/resources/core/v1/configmap/delete.go similarity index 100% rename from internal/kubernetes/core/v1/configmap/delete.go rename to internal/resources/core/v1/configmap/delete.go diff --git a/internal/kubernetes/core/v1/configmap/generate.go b/internal/resources/core/v1/configmap/generate.go similarity index 100% rename from internal/kubernetes/core/v1/configmap/generate.go rename to internal/resources/core/v1/configmap/generate.go diff --git a/internal/kubernetes/core/v1/configmap/read.go b/internal/resources/core/v1/configmap/read.go similarity index 100% rename from internal/kubernetes/core/v1/configmap/read.go rename to internal/resources/core/v1/configmap/read.go diff --git a/internal/kubernetes/core/v1/configmap/resource.go b/internal/resources/core/v1/configmap/resource.go similarity index 100% rename from internal/kubernetes/core/v1/configmap/resource.go rename to internal/resources/core/v1/configmap/resource.go diff --git a/internal/kubernetes/core/v1/configmap/update.go b/internal/resources/core/v1/configmap/update.go similarity index 100% rename from internal/kubernetes/core/v1/configmap/update.go rename to internal/resources/core/v1/configmap/update.go diff --git a/internal/kubernetes/core/v1/namespace/create.go b/internal/resources/core/v1/namespace/create.go similarity index 100% rename from internal/kubernetes/core/v1/namespace/create.go rename to internal/resources/core/v1/namespace/create.go diff --git a/internal/kubernetes/core/v1/namespace/delete.go b/internal/resources/core/v1/namespace/delete.go similarity index 100% rename from internal/kubernetes/core/v1/namespace/delete.go rename to internal/resources/core/v1/namespace/delete.go diff --git a/internal/kubernetes/core/v1/namespace/generate.go b/internal/resources/core/v1/namespace/generate.go similarity index 100% rename from internal/kubernetes/core/v1/namespace/generate.go rename to internal/resources/core/v1/namespace/generate.go diff --git a/internal/kubernetes/core/v1/namespace/read.go b/internal/resources/core/v1/namespace/read.go similarity index 100% rename from internal/kubernetes/core/v1/namespace/read.go rename to internal/resources/core/v1/namespace/read.go diff --git a/internal/kubernetes/core/v1/namespace/resource.go b/internal/resources/core/v1/namespace/resource.go similarity index 100% rename from internal/kubernetes/core/v1/namespace/resource.go rename to internal/resources/core/v1/namespace/resource.go diff --git a/internal/kubernetes/core/v1/namespace/update.go b/internal/resources/core/v1/namespace/update.go similarity index 100% rename from internal/kubernetes/core/v1/namespace/update.go rename to internal/resources/core/v1/namespace/update.go diff --git a/internal/kubernetes/core/v1/pod/container/args/expand.go b/internal/resources/core/v1/pod/container/args/expand.go similarity index 100% rename from internal/kubernetes/core/v1/pod/container/args/expand.go rename to internal/resources/core/v1/pod/container/args/expand.go diff --git a/internal/kubernetes/core/v1/pod/container/args/fields.go b/internal/resources/core/v1/pod/container/args/fields.go similarity index 100% rename from internal/kubernetes/core/v1/pod/container/args/fields.go rename to internal/resources/core/v1/pod/container/args/fields.go diff --git a/internal/kubernetes/core/v1/pod/container/command/expand.go b/internal/resources/core/v1/pod/container/command/expand.go similarity index 100% rename from internal/kubernetes/core/v1/pod/container/command/expand.go rename to internal/resources/core/v1/pod/container/command/expand.go diff --git a/internal/kubernetes/core/v1/pod/container/command/fields.go b/internal/resources/core/v1/pod/container/command/fields.go similarity index 100% rename from internal/kubernetes/core/v1/pod/container/command/fields.go rename to internal/resources/core/v1/pod/container/command/fields.go diff --git a/internal/kubernetes/core/v1/pod/container/envvar/expand.go b/internal/resources/core/v1/pod/container/envvar/expand.go similarity index 100% rename from internal/kubernetes/core/v1/pod/container/envvar/expand.go rename to internal/resources/core/v1/pod/container/envvar/expand.go diff --git a/internal/kubernetes/core/v1/pod/container/envvar/fields.go b/internal/resources/core/v1/pod/container/envvar/fields.go similarity index 100% rename from internal/kubernetes/core/v1/pod/container/envvar/fields.go rename to internal/resources/core/v1/pod/container/envvar/fields.go diff --git a/internal/kubernetes/core/v1/pod/container/envvar/flatten.go b/internal/resources/core/v1/pod/container/envvar/flatten.go similarity index 100% rename from internal/kubernetes/core/v1/pod/container/envvar/flatten.go rename to internal/resources/core/v1/pod/container/envvar/flatten.go diff --git a/internal/kubernetes/core/v1/pod/container/expand.go b/internal/resources/core/v1/pod/container/expand.go similarity index 74% rename from internal/kubernetes/core/v1/pod/container/expand.go rename to internal/resources/core/v1/pod/container/expand.go index 9c99e7ba..8513a8b1 100644 --- a/internal/kubernetes/core/v1/pod/container/expand.go +++ b/internal/resources/core/v1/pod/container/expand.go @@ -3,14 +3,14 @@ package container import ( corev1 "k8s.io/api/core/v1" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/args" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/command" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/envvar" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/lifecycle" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/mount" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/port" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/probe" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/resource" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/args" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/command" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/envvar" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/lifecycle" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/mount" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/port" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/probe" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/resource" ) // Expand will return a structured object. diff --git a/internal/kubernetes/core/v1/pod/container/fields.go b/internal/resources/core/v1/pod/container/fields.go similarity index 71% rename from internal/kubernetes/core/v1/pod/container/fields.go rename to internal/resources/core/v1/pod/container/fields.go index 327cef3f..e212f0d5 100644 --- a/internal/kubernetes/core/v1/pod/container/fields.go +++ b/internal/resources/core/v1/pod/container/fields.go @@ -3,14 +3,14 @@ package container import ( "github.com/hashicorp/terraform/helper/schema" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/args" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/command" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/envvar" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/lifecycle" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/mount" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/port" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/probe" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/resource" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/args" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/command" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/envvar" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/lifecycle" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/mount" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/port" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/probe" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/resource" ) const ( diff --git a/internal/kubernetes/core/v1/pod/container/flatten.go b/internal/resources/core/v1/pod/container/flatten.go similarity index 71% rename from internal/kubernetes/core/v1/pod/container/flatten.go rename to internal/resources/core/v1/pod/container/flatten.go index c5c0fa83..bfa32e5c 100644 --- a/internal/kubernetes/core/v1/pod/container/flatten.go +++ b/internal/resources/core/v1/pod/container/flatten.go @@ -3,12 +3,12 @@ package container import ( corev1 "k8s.io/api/core/v1" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/envvar" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/lifecycle" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/mount" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/port" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/probe" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/resource" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/envvar" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/lifecycle" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/mount" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/port" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/probe" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/resource" ) // Flatten structured object into unstructured. diff --git a/internal/kubernetes/core/v1/pod/container/handler/exec/expand.go b/internal/resources/core/v1/pod/container/handler/exec/expand.go similarity index 78% rename from internal/kubernetes/core/v1/pod/container/handler/exec/expand.go rename to internal/resources/core/v1/pod/container/handler/exec/expand.go index 8abbb483..afb6e28b 100644 --- a/internal/kubernetes/core/v1/pod/container/handler/exec/expand.go +++ b/internal/resources/core/v1/pod/container/handler/exec/expand.go @@ -3,7 +3,7 @@ package exec import ( corev1 "k8s.io/api/core/v1" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/command" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/command" ) // Expand will return a structured object. diff --git a/internal/kubernetes/core/v1/pod/container/handler/exec/fields.go b/internal/resources/core/v1/pod/container/handler/exec/fields.go similarity index 83% rename from internal/kubernetes/core/v1/pod/container/handler/exec/fields.go rename to internal/resources/core/v1/pod/container/handler/exec/fields.go index 6c2ba565..d64c6d90 100644 --- a/internal/kubernetes/core/v1/pod/container/handler/exec/fields.go +++ b/internal/resources/core/v1/pod/container/handler/exec/fields.go @@ -3,7 +3,7 @@ package exec import ( "github.com/hashicorp/terraform/helper/schema" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/command" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/command" ) const ( diff --git a/internal/kubernetes/core/v1/pod/container/handler/exec/flatten.go b/internal/resources/core/v1/pod/container/handler/exec/flatten.go similarity index 100% rename from internal/kubernetes/core/v1/pod/container/handler/exec/flatten.go rename to internal/resources/core/v1/pod/container/handler/exec/flatten.go diff --git a/internal/kubernetes/core/v1/pod/container/handler/expand.go b/internal/resources/core/v1/pod/container/handler/expand.go similarity index 64% rename from internal/kubernetes/core/v1/pod/container/handler/expand.go rename to internal/resources/core/v1/pod/container/handler/expand.go index 0b337f7c..308bda47 100644 --- a/internal/kubernetes/core/v1/pod/container/handler/expand.go +++ b/internal/resources/core/v1/pod/container/handler/expand.go @@ -3,9 +3,9 @@ package handler import ( corev1 "k8s.io/api/core/v1" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/handler/exec" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/handler/http" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/handler/tcp" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/handler/exec" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/handler/http" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/handler/tcp" ) // Expand will return a structured object. diff --git a/internal/kubernetes/core/v1/pod/container/handler/fields.go b/internal/resources/core/v1/pod/container/handler/fields.go similarity index 69% rename from internal/kubernetes/core/v1/pod/container/handler/fields.go rename to internal/resources/core/v1/pod/container/handler/fields.go index d9d21fc0..268d9099 100644 --- a/internal/kubernetes/core/v1/pod/container/handler/fields.go +++ b/internal/resources/core/v1/pod/container/handler/fields.go @@ -3,9 +3,9 @@ package handler import ( "github.com/hashicorp/terraform/helper/schema" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/handler/exec" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/handler/http" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/handler/tcp" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/handler/exec" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/handler/http" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/handler/tcp" ) const ( diff --git a/internal/kubernetes/core/v1/pod/container/handler/flatten.go b/internal/resources/core/v1/pod/container/handler/flatten.go similarity index 59% rename from internal/kubernetes/core/v1/pod/container/handler/flatten.go rename to internal/resources/core/v1/pod/container/handler/flatten.go index 00bc42be..0a4ec5da 100644 --- a/internal/kubernetes/core/v1/pod/container/handler/flatten.go +++ b/internal/resources/core/v1/pod/container/handler/flatten.go @@ -3,9 +3,9 @@ package handler import ( corev1 "k8s.io/api/core/v1" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/handler/exec" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/handler/http" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/handler/tcp" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/handler/exec" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/handler/http" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/handler/tcp" ) // Flatten structured object into unstructured. diff --git a/internal/kubernetes/core/v1/pod/container/handler/http/expand.go b/internal/resources/core/v1/pod/container/handler/http/expand.go similarity index 100% rename from internal/kubernetes/core/v1/pod/container/handler/http/expand.go rename to internal/resources/core/v1/pod/container/handler/http/expand.go diff --git a/internal/kubernetes/core/v1/pod/container/handler/http/fields.go b/internal/resources/core/v1/pod/container/handler/http/fields.go similarity index 100% rename from internal/kubernetes/core/v1/pod/container/handler/http/fields.go rename to internal/resources/core/v1/pod/container/handler/http/fields.go diff --git a/internal/kubernetes/core/v1/pod/container/handler/http/flatten.go b/internal/resources/core/v1/pod/container/handler/http/flatten.go similarity index 100% rename from internal/kubernetes/core/v1/pod/container/handler/http/flatten.go rename to internal/resources/core/v1/pod/container/handler/http/flatten.go diff --git a/internal/kubernetes/core/v1/pod/container/handler/tcp/expand.go b/internal/resources/core/v1/pod/container/handler/tcp/expand.go similarity index 100% rename from internal/kubernetes/core/v1/pod/container/handler/tcp/expand.go rename to internal/resources/core/v1/pod/container/handler/tcp/expand.go diff --git a/internal/kubernetes/core/v1/pod/container/handler/tcp/fields.go b/internal/resources/core/v1/pod/container/handler/tcp/fields.go similarity index 100% rename from internal/kubernetes/core/v1/pod/container/handler/tcp/fields.go rename to internal/resources/core/v1/pod/container/handler/tcp/fields.go diff --git a/internal/kubernetes/core/v1/pod/container/handler/tcp/flatten.go b/internal/resources/core/v1/pod/container/handler/tcp/flatten.go similarity index 100% rename from internal/kubernetes/core/v1/pod/container/handler/tcp/flatten.go rename to internal/resources/core/v1/pod/container/handler/tcp/flatten.go diff --git a/internal/kubernetes/core/v1/pod/container/lifecycle/expand.go b/internal/resources/core/v1/pod/container/lifecycle/expand.go similarity index 83% rename from internal/kubernetes/core/v1/pod/container/lifecycle/expand.go rename to internal/resources/core/v1/pod/container/lifecycle/expand.go index cf89b0e3..3c195e25 100644 --- a/internal/kubernetes/core/v1/pod/container/lifecycle/expand.go +++ b/internal/resources/core/v1/pod/container/lifecycle/expand.go @@ -3,7 +3,7 @@ package lifecycle import ( corev1 "k8s.io/api/core/v1" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/handler" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/handler" ) // Expand will return a structured object. diff --git a/internal/kubernetes/core/v1/pod/container/lifecycle/fields.go b/internal/resources/core/v1/pod/container/lifecycle/fields.go similarity index 85% rename from internal/kubernetes/core/v1/pod/container/lifecycle/fields.go rename to internal/resources/core/v1/pod/container/lifecycle/fields.go index 5f5452f7..22947a6a 100644 --- a/internal/kubernetes/core/v1/pod/container/lifecycle/fields.go +++ b/internal/resources/core/v1/pod/container/lifecycle/fields.go @@ -3,7 +3,7 @@ package lifecycle import ( "github.com/hashicorp/terraform/helper/schema" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/handler" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/handler" ) const ( diff --git a/internal/kubernetes/core/v1/pod/container/lifecycle/flatten.go b/internal/resources/core/v1/pod/container/lifecycle/flatten.go similarity index 80% rename from internal/kubernetes/core/v1/pod/container/lifecycle/flatten.go rename to internal/resources/core/v1/pod/container/lifecycle/flatten.go index a74ca3e9..2c2b119e 100644 --- a/internal/kubernetes/core/v1/pod/container/lifecycle/flatten.go +++ b/internal/resources/core/v1/pod/container/lifecycle/flatten.go @@ -3,7 +3,7 @@ package lifecycle import ( corev1 "k8s.io/api/core/v1" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/handler" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/handler" ) // Flatten structured object into unstructured. diff --git a/internal/kubernetes/core/v1/pod/container/mount/expand.go b/internal/resources/core/v1/pod/container/mount/expand.go similarity index 100% rename from internal/kubernetes/core/v1/pod/container/mount/expand.go rename to internal/resources/core/v1/pod/container/mount/expand.go diff --git a/internal/kubernetes/core/v1/pod/container/mount/fields.go b/internal/resources/core/v1/pod/container/mount/fields.go similarity index 100% rename from internal/kubernetes/core/v1/pod/container/mount/fields.go rename to internal/resources/core/v1/pod/container/mount/fields.go diff --git a/internal/kubernetes/core/v1/pod/container/mount/flatten.go b/internal/resources/core/v1/pod/container/mount/flatten.go similarity index 100% rename from internal/kubernetes/core/v1/pod/container/mount/flatten.go rename to internal/resources/core/v1/pod/container/mount/flatten.go diff --git a/internal/kubernetes/core/v1/pod/container/port/expand.go b/internal/resources/core/v1/pod/container/port/expand.go similarity index 100% rename from internal/kubernetes/core/v1/pod/container/port/expand.go rename to internal/resources/core/v1/pod/container/port/expand.go diff --git a/internal/kubernetes/core/v1/pod/container/port/fields.go b/internal/resources/core/v1/pod/container/port/fields.go similarity index 100% rename from internal/kubernetes/core/v1/pod/container/port/fields.go rename to internal/resources/core/v1/pod/container/port/fields.go diff --git a/internal/kubernetes/core/v1/pod/container/port/flatten.go b/internal/resources/core/v1/pod/container/port/flatten.go similarity index 100% rename from internal/kubernetes/core/v1/pod/container/port/flatten.go rename to internal/resources/core/v1/pod/container/port/flatten.go diff --git a/internal/kubernetes/core/v1/pod/container/probe/expand.go b/internal/resources/core/v1/pod/container/probe/expand.go similarity index 77% rename from internal/kubernetes/core/v1/pod/container/probe/expand.go rename to internal/resources/core/v1/pod/container/probe/expand.go index 5a90d5e6..9cef3515 100644 --- a/internal/kubernetes/core/v1/pod/container/probe/expand.go +++ b/internal/resources/core/v1/pod/container/probe/expand.go @@ -3,9 +3,9 @@ package probe import ( corev1 "k8s.io/api/core/v1" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/handler/exec" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/handler/http" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/handler/tcp" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/handler/exec" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/handler/http" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/handler/tcp" ) // Expand will return a structured object. diff --git a/internal/kubernetes/core/v1/pod/container/probe/fields.go b/internal/resources/core/v1/pod/container/probe/fields.go similarity index 88% rename from internal/kubernetes/core/v1/pod/container/probe/fields.go rename to internal/resources/core/v1/pod/container/probe/fields.go index 18bf5cb4..5a1cca4c 100644 --- a/internal/kubernetes/core/v1/pod/container/probe/fields.go +++ b/internal/resources/core/v1/pod/container/probe/fields.go @@ -3,9 +3,9 @@ package probe import ( "github.com/hashicorp/terraform/helper/schema" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/handler/exec" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/handler/http" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/handler/tcp" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/handler/exec" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/handler/http" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/handler/tcp" ) const ( diff --git a/internal/kubernetes/core/v1/pod/container/probe/flatten.go b/internal/resources/core/v1/pod/container/probe/flatten.go similarity index 73% rename from internal/kubernetes/core/v1/pod/container/probe/flatten.go rename to internal/resources/core/v1/pod/container/probe/flatten.go index cdf2dc30..5fadda98 100644 --- a/internal/kubernetes/core/v1/pod/container/probe/flatten.go +++ b/internal/resources/core/v1/pod/container/probe/flatten.go @@ -3,9 +3,9 @@ package probe import ( corev1 "k8s.io/api/core/v1" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/handler/exec" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/handler/http" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container/handler/tcp" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/handler/exec" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/handler/http" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container/handler/tcp" ) // Flatten structured object into unstructured. diff --git a/internal/kubernetes/core/v1/pod/container/resource/expand.go b/internal/resources/core/v1/pod/container/resource/expand.go similarity index 100% rename from internal/kubernetes/core/v1/pod/container/resource/expand.go rename to internal/resources/core/v1/pod/container/resource/expand.go diff --git a/internal/kubernetes/core/v1/pod/container/resource/fields.go b/internal/resources/core/v1/pod/container/resource/fields.go similarity index 100% rename from internal/kubernetes/core/v1/pod/container/resource/fields.go rename to internal/resources/core/v1/pod/container/resource/fields.go diff --git a/internal/kubernetes/core/v1/pod/container/resource/flatten.go b/internal/resources/core/v1/pod/container/resource/flatten.go similarity index 100% rename from internal/kubernetes/core/v1/pod/container/resource/flatten.go rename to internal/resources/core/v1/pod/container/resource/flatten.go diff --git a/internal/kubernetes/core/v1/pod/expand.go b/internal/resources/core/v1/pod/expand.go similarity index 92% rename from internal/kubernetes/core/v1/pod/expand.go rename to internal/resources/core/v1/pod/expand.go index 4a71d50c..f82fd583 100644 --- a/internal/kubernetes/core/v1/pod/expand.go +++ b/internal/resources/core/v1/pod/expand.go @@ -5,8 +5,8 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/previousnext/terraform-provider-k8s/internal/interfaceutils" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/volume" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/volume" ) // Expand will return a structured object. diff --git a/internal/kubernetes/core/v1/pod/fields.go b/internal/resources/core/v1/pod/fields.go similarity index 91% rename from internal/kubernetes/core/v1/pod/fields.go rename to internal/resources/core/v1/pod/fields.go index e197c2db..2796f067 100644 --- a/internal/kubernetes/core/v1/pod/fields.go +++ b/internal/resources/core/v1/pod/fields.go @@ -3,8 +3,8 @@ package pod import ( "github.com/hashicorp/terraform/helper/schema" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/volume" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/volume" ) const ( diff --git a/internal/kubernetes/core/v1/pod/flatten.go b/internal/resources/core/v1/pod/flatten.go similarity index 87% rename from internal/kubernetes/core/v1/pod/flatten.go rename to internal/resources/core/v1/pod/flatten.go index bcdf76eb..4db094f7 100644 --- a/internal/kubernetes/core/v1/pod/flatten.go +++ b/internal/resources/core/v1/pod/flatten.go @@ -3,8 +3,8 @@ package pod import ( corev1 "k8s.io/api/core/v1" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/container" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/pod/volume" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/container" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/pod/volume" ) // Flatten structured object into unstructured. diff --git a/internal/kubernetes/core/v1/pod/volume/expand.go b/internal/resources/core/v1/pod/volume/expand.go similarity index 100% rename from internal/kubernetes/core/v1/pod/volume/expand.go rename to internal/resources/core/v1/pod/volume/expand.go diff --git a/internal/kubernetes/core/v1/pod/volume/fields.go b/internal/resources/core/v1/pod/volume/fields.go similarity index 100% rename from internal/kubernetes/core/v1/pod/volume/fields.go rename to internal/resources/core/v1/pod/volume/fields.go diff --git a/internal/kubernetes/core/v1/pod/volume/flatten.go b/internal/resources/core/v1/pod/volume/flatten.go similarity index 100% rename from internal/kubernetes/core/v1/pod/volume/flatten.go rename to internal/resources/core/v1/pod/volume/flatten.go diff --git a/internal/kubernetes/core/v1/secret/create.go b/internal/resources/core/v1/secret/create.go similarity index 100% rename from internal/kubernetes/core/v1/secret/create.go rename to internal/resources/core/v1/secret/create.go diff --git a/internal/kubernetes/core/v1/secret/data/expand.go b/internal/resources/core/v1/secret/data/expand.go similarity index 100% rename from internal/kubernetes/core/v1/secret/data/expand.go rename to internal/resources/core/v1/secret/data/expand.go diff --git a/internal/kubernetes/core/v1/secret/data/fields.go b/internal/resources/core/v1/secret/data/fields.go similarity index 100% rename from internal/kubernetes/core/v1/secret/data/fields.go rename to internal/resources/core/v1/secret/data/fields.go diff --git a/internal/kubernetes/core/v1/secret/delete.go b/internal/resources/core/v1/secret/delete.go similarity index 100% rename from internal/kubernetes/core/v1/secret/delete.go rename to internal/resources/core/v1/secret/delete.go diff --git a/internal/kubernetes/core/v1/secret/generate.go b/internal/resources/core/v1/secret/generate.go similarity index 90% rename from internal/kubernetes/core/v1/secret/generate.go rename to internal/resources/core/v1/secret/generate.go index 040a35b2..4662f842 100644 --- a/internal/kubernetes/core/v1/secret/generate.go +++ b/internal/resources/core/v1/secret/generate.go @@ -6,7 +6,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/previousnext/terraform-provider-k8s/internal/interfaceutils" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/secret/data" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/secret/data" ) // Generate the Service. diff --git a/internal/kubernetes/core/v1/secret/read.go b/internal/resources/core/v1/secret/read.go similarity index 100% rename from internal/kubernetes/core/v1/secret/read.go rename to internal/resources/core/v1/secret/read.go diff --git a/internal/kubernetes/core/v1/secret/resource.go b/internal/resources/core/v1/secret/resource.go similarity index 91% rename from internal/kubernetes/core/v1/secret/resource.go rename to internal/resources/core/v1/secret/resource.go index c814540d..797e0f46 100644 --- a/internal/kubernetes/core/v1/secret/resource.go +++ b/internal/resources/core/v1/secret/resource.go @@ -3,7 +3,7 @@ package secret import ( "github.com/hashicorp/terraform/helper/schema" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/secret/data" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/secret/data" ) const ( diff --git a/internal/kubernetes/core/v1/secret/update.go b/internal/resources/core/v1/secret/update.go similarity index 100% rename from internal/kubernetes/core/v1/secret/update.go rename to internal/resources/core/v1/secret/update.go diff --git a/internal/kubernetes/core/v1/service/create.go b/internal/resources/core/v1/service/create.go similarity index 100% rename from internal/kubernetes/core/v1/service/create.go rename to internal/resources/core/v1/service/create.go diff --git a/internal/kubernetes/core/v1/service/delete.go b/internal/resources/core/v1/service/delete.go similarity index 100% rename from internal/kubernetes/core/v1/service/delete.go rename to internal/resources/core/v1/service/delete.go diff --git a/internal/kubernetes/core/v1/service/generate.go b/internal/resources/core/v1/service/generate.go similarity index 92% rename from internal/kubernetes/core/v1/service/generate.go rename to internal/resources/core/v1/service/generate.go index f4f2f42d..a9d9ce8c 100644 --- a/internal/kubernetes/core/v1/service/generate.go +++ b/internal/resources/core/v1/service/generate.go @@ -6,7 +6,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/previousnext/terraform-provider-k8s/internal/interfaceutils" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/service/port" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/service/port" ) // Generate the Service. diff --git a/internal/kubernetes/core/v1/service/ingress/expand.go b/internal/resources/core/v1/service/ingress/expand.go similarity index 100% rename from internal/kubernetes/core/v1/service/ingress/expand.go rename to internal/resources/core/v1/service/ingress/expand.go diff --git a/internal/kubernetes/core/v1/service/ingress/fields.go b/internal/resources/core/v1/service/ingress/fields.go similarity index 100% rename from internal/kubernetes/core/v1/service/ingress/fields.go rename to internal/resources/core/v1/service/ingress/fields.go diff --git a/internal/kubernetes/core/v1/service/ingress/flatten.go b/internal/resources/core/v1/service/ingress/flatten.go similarity index 100% rename from internal/kubernetes/core/v1/service/ingress/flatten.go rename to internal/resources/core/v1/service/ingress/flatten.go diff --git a/internal/kubernetes/core/v1/service/port/expand.go b/internal/resources/core/v1/service/port/expand.go similarity index 100% rename from internal/kubernetes/core/v1/service/port/expand.go rename to internal/resources/core/v1/service/port/expand.go diff --git a/internal/kubernetes/core/v1/service/port/fields.go b/internal/resources/core/v1/service/port/fields.go similarity index 100% rename from internal/kubernetes/core/v1/service/port/fields.go rename to internal/resources/core/v1/service/port/fields.go diff --git a/internal/kubernetes/core/v1/service/port/flatten.go b/internal/resources/core/v1/service/port/flatten.go similarity index 100% rename from internal/kubernetes/core/v1/service/port/flatten.go rename to internal/resources/core/v1/service/port/flatten.go diff --git a/internal/kubernetes/core/v1/service/read.go b/internal/resources/core/v1/service/read.go similarity index 87% rename from internal/kubernetes/core/v1/service/read.go rename to internal/resources/core/v1/service/read.go index 4b81119f..c20aa73c 100644 --- a/internal/kubernetes/core/v1/service/read.go +++ b/internal/resources/core/v1/service/read.go @@ -6,8 +6,8 @@ import ( kerrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/service/ingress" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/service/port" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/service/ingress" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/service/port" "github.com/previousnext/terraform-provider-k8s/internal/terraform/config" "github.com/previousnext/terraform-provider-k8s/internal/terraform/id" ) diff --git a/internal/kubernetes/core/v1/service/resource.go b/internal/resources/core/v1/service/resource.go similarity index 88% rename from internal/kubernetes/core/v1/service/resource.go rename to internal/resources/core/v1/service/resource.go index a967ad08..34e76a69 100644 --- a/internal/kubernetes/core/v1/service/resource.go +++ b/internal/resources/core/v1/service/resource.go @@ -3,8 +3,8 @@ package service import ( "github.com/hashicorp/terraform/helper/schema" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/service/ingress" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/service/port" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/service/ingress" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/service/port" ) const ( diff --git a/internal/kubernetes/core/v1/service/update.go b/internal/resources/core/v1/service/update.go similarity index 100% rename from internal/kubernetes/core/v1/service/update.go rename to internal/resources/core/v1/service/update.go diff --git a/internal/kubernetes/core/v1/serviceaccount/create.go b/internal/resources/core/v1/serviceaccount/create.go similarity index 100% rename from internal/kubernetes/core/v1/serviceaccount/create.go rename to internal/resources/core/v1/serviceaccount/create.go diff --git a/internal/kubernetes/core/v1/serviceaccount/delete.go b/internal/resources/core/v1/serviceaccount/delete.go similarity index 100% rename from internal/kubernetes/core/v1/serviceaccount/delete.go rename to internal/resources/core/v1/serviceaccount/delete.go diff --git a/internal/kubernetes/core/v1/serviceaccount/generate.go b/internal/resources/core/v1/serviceaccount/generate.go similarity index 100% rename from internal/kubernetes/core/v1/serviceaccount/generate.go rename to internal/resources/core/v1/serviceaccount/generate.go diff --git a/internal/kubernetes/core/v1/serviceaccount/read.go b/internal/resources/core/v1/serviceaccount/read.go similarity index 100% rename from internal/kubernetes/core/v1/serviceaccount/read.go rename to internal/resources/core/v1/serviceaccount/read.go diff --git a/internal/kubernetes/core/v1/serviceaccount/resource.go b/internal/resources/core/v1/serviceaccount/resource.go similarity index 100% rename from internal/kubernetes/core/v1/serviceaccount/resource.go rename to internal/resources/core/v1/serviceaccount/resource.go diff --git a/internal/kubernetes/core/v1/serviceaccount/update.go b/internal/resources/core/v1/serviceaccount/update.go similarity index 100% rename from internal/kubernetes/core/v1/serviceaccount/update.go rename to internal/resources/core/v1/serviceaccount/update.go diff --git a/internal/kubernetes/policy/v1beta1/poddisruptionbudget/create.go b/internal/resources/policy/v1beta1/poddisruptionbudget/create.go similarity index 100% rename from internal/kubernetes/policy/v1beta1/poddisruptionbudget/create.go rename to internal/resources/policy/v1beta1/poddisruptionbudget/create.go diff --git a/internal/kubernetes/policy/v1beta1/poddisruptionbudget/delete.go b/internal/resources/policy/v1beta1/poddisruptionbudget/delete.go similarity index 100% rename from internal/kubernetes/policy/v1beta1/poddisruptionbudget/delete.go rename to internal/resources/policy/v1beta1/poddisruptionbudget/delete.go diff --git a/internal/kubernetes/policy/v1beta1/poddisruptionbudget/generate.go b/internal/resources/policy/v1beta1/poddisruptionbudget/generate.go similarity index 100% rename from internal/kubernetes/policy/v1beta1/poddisruptionbudget/generate.go rename to internal/resources/policy/v1beta1/poddisruptionbudget/generate.go diff --git a/internal/kubernetes/policy/v1beta1/poddisruptionbudget/read.go b/internal/resources/policy/v1beta1/poddisruptionbudget/read.go similarity index 100% rename from internal/kubernetes/policy/v1beta1/poddisruptionbudget/read.go rename to internal/resources/policy/v1beta1/poddisruptionbudget/read.go diff --git a/internal/kubernetes/policy/v1beta1/poddisruptionbudget/resource.go b/internal/resources/policy/v1beta1/poddisruptionbudget/resource.go similarity index 100% rename from internal/kubernetes/policy/v1beta1/poddisruptionbudget/resource.go rename to internal/resources/policy/v1beta1/poddisruptionbudget/resource.go diff --git a/internal/kubernetes/policy/v1beta1/poddisruptionbudget/update.go b/internal/resources/policy/v1beta1/poddisruptionbudget/update.go similarity index 100% rename from internal/kubernetes/policy/v1beta1/poddisruptionbudget/update.go rename to internal/resources/policy/v1beta1/poddisruptionbudget/update.go diff --git a/internal/kubernetes/rbac/v1/clusterrole/create.go b/internal/resources/rbac/v1/clusterrole/create.go similarity index 100% rename from internal/kubernetes/rbac/v1/clusterrole/create.go rename to internal/resources/rbac/v1/clusterrole/create.go diff --git a/internal/kubernetes/rbac/v1/clusterrole/delete.go b/internal/resources/rbac/v1/clusterrole/delete.go similarity index 100% rename from internal/kubernetes/rbac/v1/clusterrole/delete.go rename to internal/resources/rbac/v1/clusterrole/delete.go diff --git a/internal/kubernetes/rbac/v1/clusterrole/generate.go b/internal/resources/rbac/v1/clusterrole/generate.go similarity index 88% rename from internal/kubernetes/rbac/v1/clusterrole/generate.go rename to internal/resources/rbac/v1/clusterrole/generate.go index 26133301..17d87bfa 100644 --- a/internal/kubernetes/rbac/v1/clusterrole/generate.go +++ b/internal/resources/rbac/v1/clusterrole/generate.go @@ -6,7 +6,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/previousnext/terraform-provider-k8s/internal/interfaceutils" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/rbac/v1/role/rule" + "github.com/previousnext/terraform-provider-k8s/internal/resources/rbac/v1/role/rule" ) // Generate the ClusterRole. diff --git a/internal/kubernetes/rbac/v1/clusterrole/read.go b/internal/resources/rbac/v1/clusterrole/read.go similarity index 91% rename from internal/kubernetes/rbac/v1/clusterrole/read.go rename to internal/resources/rbac/v1/clusterrole/read.go index 1cc24661..414c0334 100644 --- a/internal/kubernetes/rbac/v1/clusterrole/read.go +++ b/internal/resources/rbac/v1/clusterrole/read.go @@ -6,7 +6,7 @@ import ( kerrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/rbac/v1/role/rule" + "github.com/previousnext/terraform-provider-k8s/internal/resources/rbac/v1/role/rule" "github.com/previousnext/terraform-provider-k8s/internal/terraform/config" "github.com/previousnext/terraform-provider-k8s/internal/terraform/id" ) diff --git a/internal/kubernetes/rbac/v1/clusterrole/resource.go b/internal/resources/rbac/v1/clusterrole/resource.go similarity index 88% rename from internal/kubernetes/rbac/v1/clusterrole/resource.go rename to internal/resources/rbac/v1/clusterrole/resource.go index b3ae464e..5f2cd227 100644 --- a/internal/kubernetes/rbac/v1/clusterrole/resource.go +++ b/internal/resources/rbac/v1/clusterrole/resource.go @@ -3,7 +3,7 @@ package clusterrole import ( "github.com/hashicorp/terraform/helper/schema" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/rbac/v1/role/rule" + "github.com/previousnext/terraform-provider-k8s/internal/resources/rbac/v1/role/rule" ) const ( diff --git a/internal/kubernetes/rbac/v1/clusterrole/update.go b/internal/resources/rbac/v1/clusterrole/update.go similarity index 100% rename from internal/kubernetes/rbac/v1/clusterrole/update.go rename to internal/resources/rbac/v1/clusterrole/update.go diff --git a/internal/kubernetes/rbac/v1/clusterrolebinding/create.go b/internal/resources/rbac/v1/clusterrolebinding/create.go similarity index 100% rename from internal/kubernetes/rbac/v1/clusterrolebinding/create.go rename to internal/resources/rbac/v1/clusterrolebinding/create.go diff --git a/internal/kubernetes/rbac/v1/clusterrolebinding/delete.go b/internal/resources/rbac/v1/clusterrolebinding/delete.go similarity index 100% rename from internal/kubernetes/rbac/v1/clusterrolebinding/delete.go rename to internal/resources/rbac/v1/clusterrolebinding/delete.go diff --git a/internal/kubernetes/rbac/v1/clusterrolebinding/generate.go b/internal/resources/rbac/v1/clusterrolebinding/generate.go similarity index 90% rename from internal/kubernetes/rbac/v1/clusterrolebinding/generate.go rename to internal/resources/rbac/v1/clusterrolebinding/generate.go index 789eb8b8..8571b984 100644 --- a/internal/kubernetes/rbac/v1/clusterrolebinding/generate.go +++ b/internal/resources/rbac/v1/clusterrolebinding/generate.go @@ -6,7 +6,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/previousnext/terraform-provider-k8s/internal/interfaceutils" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/rbac/v1/rolebinding/subject" + "github.com/previousnext/terraform-provider-k8s/internal/resources/rbac/v1/rolebinding/subject" ) // Generate the ClusterRoleBinding. diff --git a/internal/kubernetes/rbac/v1/clusterrolebinding/read.go b/internal/resources/rbac/v1/clusterrolebinding/read.go similarity index 92% rename from internal/kubernetes/rbac/v1/clusterrolebinding/read.go rename to internal/resources/rbac/v1/clusterrolebinding/read.go index cb2f9530..5284b2e2 100644 --- a/internal/kubernetes/rbac/v1/clusterrolebinding/read.go +++ b/internal/resources/rbac/v1/clusterrolebinding/read.go @@ -6,7 +6,7 @@ import ( kerrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/rbac/v1/rolebinding/subject" + "github.com/previousnext/terraform-provider-k8s/internal/resources/rbac/v1/rolebinding/subject" "github.com/previousnext/terraform-provider-k8s/internal/terraform/config" "github.com/previousnext/terraform-provider-k8s/internal/terraform/id" ) diff --git a/internal/kubernetes/rbac/v1/clusterrolebinding/resource.go b/internal/resources/rbac/v1/clusterrolebinding/resource.go similarity index 92% rename from internal/kubernetes/rbac/v1/clusterrolebinding/resource.go rename to internal/resources/rbac/v1/clusterrolebinding/resource.go index 7448bd4e..2c6cf65f 100644 --- a/internal/kubernetes/rbac/v1/clusterrolebinding/resource.go +++ b/internal/resources/rbac/v1/clusterrolebinding/resource.go @@ -3,7 +3,7 @@ package clusterrolebinding import ( "github.com/hashicorp/terraform/helper/schema" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/rbac/v1/rolebinding/subject" + "github.com/previousnext/terraform-provider-k8s/internal/resources/rbac/v1/rolebinding/subject" ) const ( diff --git a/internal/kubernetes/rbac/v1/clusterrolebinding/update.go b/internal/resources/rbac/v1/clusterrolebinding/update.go similarity index 100% rename from internal/kubernetes/rbac/v1/clusterrolebinding/update.go rename to internal/resources/rbac/v1/clusterrolebinding/update.go diff --git a/internal/kubernetes/rbac/v1/role/create.go b/internal/resources/rbac/v1/role/create.go similarity index 100% rename from internal/kubernetes/rbac/v1/role/create.go rename to internal/resources/rbac/v1/role/create.go diff --git a/internal/kubernetes/rbac/v1/role/delete.go b/internal/resources/rbac/v1/role/delete.go similarity index 100% rename from internal/kubernetes/rbac/v1/role/delete.go rename to internal/resources/rbac/v1/role/delete.go diff --git a/internal/kubernetes/rbac/v1/role/generate.go b/internal/resources/rbac/v1/role/generate.go similarity index 89% rename from internal/kubernetes/rbac/v1/role/generate.go rename to internal/resources/rbac/v1/role/generate.go index 94f5acae..8da9aa37 100644 --- a/internal/kubernetes/rbac/v1/role/generate.go +++ b/internal/resources/rbac/v1/role/generate.go @@ -6,7 +6,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/previousnext/terraform-provider-k8s/internal/interfaceutils" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/rbac/v1/role/rule" + "github.com/previousnext/terraform-provider-k8s/internal/resources/rbac/v1/role/rule" ) // Generate the Role. diff --git a/internal/kubernetes/rbac/v1/role/read.go b/internal/resources/rbac/v1/role/read.go similarity index 92% rename from internal/kubernetes/rbac/v1/role/read.go rename to internal/resources/rbac/v1/role/read.go index 5fb7b8ae..f32146cd 100644 --- a/internal/kubernetes/rbac/v1/role/read.go +++ b/internal/resources/rbac/v1/role/read.go @@ -6,7 +6,7 @@ import ( kerrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/rbac/v1/role/rule" + "github.com/previousnext/terraform-provider-k8s/internal/resources/rbac/v1/role/rule" "github.com/previousnext/terraform-provider-k8s/internal/terraform/config" "github.com/previousnext/terraform-provider-k8s/internal/terraform/id" ) diff --git a/internal/kubernetes/rbac/v1/role/resource.go b/internal/resources/rbac/v1/role/resource.go similarity index 91% rename from internal/kubernetes/rbac/v1/role/resource.go rename to internal/resources/rbac/v1/role/resource.go index eb344db3..39b49775 100644 --- a/internal/kubernetes/rbac/v1/role/resource.go +++ b/internal/resources/rbac/v1/role/resource.go @@ -3,7 +3,7 @@ package role import ( "github.com/hashicorp/terraform/helper/schema" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/rbac/v1/role/rule" + "github.com/previousnext/terraform-provider-k8s/internal/resources/rbac/v1/role/rule" ) const ( diff --git a/internal/kubernetes/rbac/v1/role/rule/apigroups/expand.go b/internal/resources/rbac/v1/role/rule/apigroups/expand.go similarity index 100% rename from internal/kubernetes/rbac/v1/role/rule/apigroups/expand.go rename to internal/resources/rbac/v1/role/rule/apigroups/expand.go diff --git a/internal/kubernetes/rbac/v1/role/rule/apigroups/fields.go b/internal/resources/rbac/v1/role/rule/apigroups/fields.go similarity index 100% rename from internal/kubernetes/rbac/v1/role/rule/apigroups/fields.go rename to internal/resources/rbac/v1/role/rule/apigroups/fields.go diff --git a/internal/kubernetes/rbac/v1/role/rule/apigroups/flatten.go b/internal/resources/rbac/v1/role/rule/apigroups/flatten.go similarity index 100% rename from internal/kubernetes/rbac/v1/role/rule/apigroups/flatten.go rename to internal/resources/rbac/v1/role/rule/apigroups/flatten.go diff --git a/internal/kubernetes/rbac/v1/role/rule/expand.go b/internal/resources/rbac/v1/role/rule/expand.go similarity index 73% rename from internal/kubernetes/rbac/v1/role/rule/expand.go rename to internal/resources/rbac/v1/role/rule/expand.go index 86e571f0..d1ba0d44 100644 --- a/internal/kubernetes/rbac/v1/role/rule/expand.go +++ b/internal/resources/rbac/v1/role/rule/expand.go @@ -4,10 +4,10 @@ import ( rbacv1 "k8s.io/api/rbac/v1" "github.com/previousnext/terraform-provider-k8s/internal/interfaceutils" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/rbac/v1/role/rule/apigroups" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/rbac/v1/role/rule/resourcenames" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/rbac/v1/role/rule/resources" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/rbac/v1/role/rule/verbs" + "github.com/previousnext/terraform-provider-k8s/internal/resources/rbac/v1/role/rule/apigroups" + "github.com/previousnext/terraform-provider-k8s/internal/resources/rbac/v1/role/rule/resourcenames" + "github.com/previousnext/terraform-provider-k8s/internal/resources/rbac/v1/role/rule/resources" + "github.com/previousnext/terraform-provider-k8s/internal/resources/rbac/v1/role/rule/verbs" ) // Expand will return a structured object. diff --git a/internal/kubernetes/rbac/v1/role/rule/fields.go b/internal/resources/rbac/v1/role/rule/fields.go similarity index 75% rename from internal/kubernetes/rbac/v1/role/rule/fields.go rename to internal/resources/rbac/v1/role/rule/fields.go index 4e2d0c9e..37b21b2c 100644 --- a/internal/kubernetes/rbac/v1/role/rule/fields.go +++ b/internal/resources/rbac/v1/role/rule/fields.go @@ -3,10 +3,10 @@ package rule import ( "github.com/hashicorp/terraform/helper/schema" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/rbac/v1/role/rule/apigroups" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/rbac/v1/role/rule/resourcenames" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/rbac/v1/role/rule/resources" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/rbac/v1/role/rule/verbs" + "github.com/previousnext/terraform-provider-k8s/internal/resources/rbac/v1/role/rule/apigroups" + "github.com/previousnext/terraform-provider-k8s/internal/resources/rbac/v1/role/rule/resourcenames" + "github.com/previousnext/terraform-provider-k8s/internal/resources/rbac/v1/role/rule/resources" + "github.com/previousnext/terraform-provider-k8s/internal/resources/rbac/v1/role/rule/verbs" ) const ( diff --git a/internal/kubernetes/rbac/v1/role/rule/flatten.go b/internal/resources/rbac/v1/role/rule/flatten.go similarity index 100% rename from internal/kubernetes/rbac/v1/role/rule/flatten.go rename to internal/resources/rbac/v1/role/rule/flatten.go diff --git a/internal/kubernetes/rbac/v1/role/rule/resourcenames/expand.go b/internal/resources/rbac/v1/role/rule/resourcenames/expand.go similarity index 100% rename from internal/kubernetes/rbac/v1/role/rule/resourcenames/expand.go rename to internal/resources/rbac/v1/role/rule/resourcenames/expand.go diff --git a/internal/kubernetes/rbac/v1/role/rule/resourcenames/fields.go b/internal/resources/rbac/v1/role/rule/resourcenames/fields.go similarity index 100% rename from internal/kubernetes/rbac/v1/role/rule/resourcenames/fields.go rename to internal/resources/rbac/v1/role/rule/resourcenames/fields.go diff --git a/internal/kubernetes/rbac/v1/role/rule/resources/expand.go b/internal/resources/rbac/v1/role/rule/resources/expand.go similarity index 100% rename from internal/kubernetes/rbac/v1/role/rule/resources/expand.go rename to internal/resources/rbac/v1/role/rule/resources/expand.go diff --git a/internal/kubernetes/rbac/v1/role/rule/resources/fields.go b/internal/resources/rbac/v1/role/rule/resources/fields.go similarity index 100% rename from internal/kubernetes/rbac/v1/role/rule/resources/fields.go rename to internal/resources/rbac/v1/role/rule/resources/fields.go diff --git a/internal/kubernetes/rbac/v1/role/rule/verbs/expand.go b/internal/resources/rbac/v1/role/rule/verbs/expand.go similarity index 100% rename from internal/kubernetes/rbac/v1/role/rule/verbs/expand.go rename to internal/resources/rbac/v1/role/rule/verbs/expand.go diff --git a/internal/kubernetes/rbac/v1/role/rule/verbs/fields.go b/internal/resources/rbac/v1/role/rule/verbs/fields.go similarity index 100% rename from internal/kubernetes/rbac/v1/role/rule/verbs/fields.go rename to internal/resources/rbac/v1/role/rule/verbs/fields.go diff --git a/internal/kubernetes/rbac/v1/role/update.go b/internal/resources/rbac/v1/role/update.go similarity index 100% rename from internal/kubernetes/rbac/v1/role/update.go rename to internal/resources/rbac/v1/role/update.go diff --git a/internal/kubernetes/rbac/v1/rolebinding/create.go b/internal/resources/rbac/v1/rolebinding/create.go similarity index 100% rename from internal/kubernetes/rbac/v1/rolebinding/create.go rename to internal/resources/rbac/v1/rolebinding/create.go diff --git a/internal/kubernetes/rbac/v1/rolebinding/delete.go b/internal/resources/rbac/v1/rolebinding/delete.go similarity index 100% rename from internal/kubernetes/rbac/v1/rolebinding/delete.go rename to internal/resources/rbac/v1/rolebinding/delete.go diff --git a/internal/kubernetes/rbac/v1/rolebinding/generate.go b/internal/resources/rbac/v1/rolebinding/generate.go similarity index 91% rename from internal/kubernetes/rbac/v1/rolebinding/generate.go rename to internal/resources/rbac/v1/rolebinding/generate.go index dfcae2f4..b354a469 100644 --- a/internal/kubernetes/rbac/v1/rolebinding/generate.go +++ b/internal/resources/rbac/v1/rolebinding/generate.go @@ -6,7 +6,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/previousnext/terraform-provider-k8s/internal/interfaceutils" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/rbac/v1/rolebinding/subject" + "github.com/previousnext/terraform-provider-k8s/internal/resources/rbac/v1/rolebinding/subject" ) // Generate the RoleBinding. diff --git a/internal/kubernetes/rbac/v1/rolebinding/read.go b/internal/resources/rbac/v1/rolebinding/read.go similarity index 92% rename from internal/kubernetes/rbac/v1/rolebinding/read.go rename to internal/resources/rbac/v1/rolebinding/read.go index 206a45df..2e6cf73f 100644 --- a/internal/kubernetes/rbac/v1/rolebinding/read.go +++ b/internal/resources/rbac/v1/rolebinding/read.go @@ -6,7 +6,7 @@ import ( kerrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/rbac/v1/rolebinding/subject" + "github.com/previousnext/terraform-provider-k8s/internal/resources/rbac/v1/rolebinding/subject" "github.com/previousnext/terraform-provider-k8s/internal/terraform/config" "github.com/previousnext/terraform-provider-k8s/internal/terraform/id" ) diff --git a/internal/kubernetes/rbac/v1/rolebinding/resource.go b/internal/resources/rbac/v1/rolebinding/resource.go similarity index 93% rename from internal/kubernetes/rbac/v1/rolebinding/resource.go rename to internal/resources/rbac/v1/rolebinding/resource.go index 3203bf42..8057fa16 100644 --- a/internal/kubernetes/rbac/v1/rolebinding/resource.go +++ b/internal/resources/rbac/v1/rolebinding/resource.go @@ -3,7 +3,7 @@ package rolebinding import ( "github.com/hashicorp/terraform/helper/schema" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/rbac/v1/rolebinding/subject" + "github.com/previousnext/terraform-provider-k8s/internal/resources/rbac/v1/rolebinding/subject" ) const ( diff --git a/internal/kubernetes/rbac/v1/rolebinding/subject/expand.go b/internal/resources/rbac/v1/rolebinding/subject/expand.go similarity index 100% rename from internal/kubernetes/rbac/v1/rolebinding/subject/expand.go rename to internal/resources/rbac/v1/rolebinding/subject/expand.go diff --git a/internal/kubernetes/rbac/v1/rolebinding/subject/fields.go b/internal/resources/rbac/v1/rolebinding/subject/fields.go similarity index 100% rename from internal/kubernetes/rbac/v1/rolebinding/subject/fields.go rename to internal/resources/rbac/v1/rolebinding/subject/fields.go diff --git a/internal/kubernetes/rbac/v1/rolebinding/subject/flatten.go b/internal/resources/rbac/v1/rolebinding/subject/flatten.go similarity index 100% rename from internal/kubernetes/rbac/v1/rolebinding/subject/flatten.go rename to internal/resources/rbac/v1/rolebinding/subject/flatten.go diff --git a/internal/kubernetes/rbac/v1/rolebinding/update.go b/internal/resources/rbac/v1/rolebinding/update.go similarity index 100% rename from internal/kubernetes/rbac/v1/rolebinding/update.go rename to internal/resources/rbac/v1/rolebinding/update.go diff --git a/internal/resources/resources.go b/internal/resources/resources.go new file mode 100644 index 00000000..d56b34cf --- /dev/null +++ b/internal/resources/resources.go @@ -0,0 +1,84 @@ +package resources + +import ( + "github.com/hashicorp/terraform/helper/schema" + + "github.com/previousnext/terraform-provider-k8s/internal/resources/apiextensions/v1beta1/crd" + "github.com/previousnext/terraform-provider-k8s/internal/resources/apiregistration/v1beta1/apiservice" + "github.com/previousnext/terraform-provider-k8s/internal/resources/apps/v1/daemonset" + "github.com/previousnext/terraform-provider-k8s/internal/resources/apps/v1/deployment" + "github.com/previousnext/terraform-provider-k8s/internal/resources/apps/v1/statefulset" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/configmap" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/namespace" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/secret" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/service" + "github.com/previousnext/terraform-provider-k8s/internal/resources/core/v1/serviceaccount" + "github.com/previousnext/terraform-provider-k8s/internal/resources/policy/v1beta1/poddisruptionbudget" + "github.com/previousnext/terraform-provider-k8s/internal/resources/rbac/v1/clusterrole" + "github.com/previousnext/terraform-provider-k8s/internal/resources/rbac/v1/clusterrolebinding" + "github.com/previousnext/terraform-provider-k8s/internal/resources/rbac/v1/role" + "github.com/previousnext/terraform-provider-k8s/internal/resources/rbac/v1/rolebinding" + "github.com/previousnext/terraform-provider-k8s/internal/resources/storage/v1/storageclass" +) + +const ( + // FieldDeployment identifier for the Kubernetes Deployment. + FieldDeployment = "k8s_apps_v1_deployment" + // FieldDaemonSet identifier for the Kubernetes DaemonSet. + FieldDaemonSet = "k8s_apps_v1_daemonset" + // FieldStatefulSet identifier for the Kubernetes StatefulSet. + FieldStatefulSet = "k8s_apps_v1_statefulset" + + // FieldStorageClass identifier for the Kubernetes StorageClass. + FieldStorageClass = "k8s_storage_v1_storageclass" + + // FieldNamespace identifier for the Kubernetes Namespace. + FieldNamespace = "k8s_core_v1_namespace" + // FieldSecret identifier for the Kubernetes Secret. + FieldSecret = "k8s_core_v1_secret" + // FieldConfigMap identifier for the Kubernetes Secret. + FieldConfigMap = "k8s_core_v1_configmap" + // FieldServiceAccount identifier for the Kubernetes ServiceAccount. + FieldServiceAccount = "k8s_core_v1_serviceaccount" + // FieldService identifier for the Kubernetes Service. + FieldService = "k8s_core_v1_service" + + // FieldRole identifier for the Kubernetes Role. + FieldRole = "k8s_rbac_v1_role" + // FieldRoleBinding identifier for the Kubernetes RoleBinding. + FieldRoleBinding = "k8s_rbac_v1_rolebinding" + // FieldClusterRole identifier for the Kubernetes ClusterRole. + FieldClusterRole = "k8s_rbac_v1_clusterrole" + // FieldClusterRoleBinding identifier for the Kubernetes ClusterRoleBinding. + FieldClusterRoleBinding = "k8s_rbac_v1_clusterrolebinding" + + // FieldCustomtResourceDefinition identifier for the Kubernetes CustomtResourceDefinition. + FieldCustomtResourceDefinition = "k8s_apiextensions_v1beta1_customresourcedefinition" + + // FieldAPIService identifier for the Kubernetes APIService. + FieldAPIService = "k8s_apiregistration_v1beta1_apiservice" + + // FieldPodDisruptionBudget identifier for the Kubernetes PodDisruptionBudget. + FieldPodDisruptionBudget = "k8s_policy_v1beta1_poddisruptionbudget" +) + +func ResourcesMap() map[string]*schema.Resource { + return map[string]*schema.Resource{ + FieldNamespace: namespace.Resource(), + FieldDeployment: deployment.Resource(), + FieldDaemonSet: daemonset.Resource(), + FieldStatefulSet: statefulset.Resource(), + FieldStorageClass: storageclass.Resource(), + FieldServiceAccount: serviceaccount.Resource(), + FieldService: service.Resource(), + FieldSecret: secret.Resource(), + FieldConfigMap: configmap.Resource(), + FieldRole: role.Resource(), + FieldRoleBinding: rolebinding.Resource(), + FieldClusterRole: clusterrole.Resource(), + FieldClusterRoleBinding: clusterrolebinding.Resource(), + FieldCustomtResourceDefinition: crd.Resource(), + FieldAPIService: apiservice.Resource(), + FieldPodDisruptionBudget: poddisruptionbudget.Resource(), + } +} diff --git a/internal/kubernetes/storage/v1/storageclass/create.go b/internal/resources/storage/v1/storageclass/create.go similarity index 100% rename from internal/kubernetes/storage/v1/storageclass/create.go rename to internal/resources/storage/v1/storageclass/create.go diff --git a/internal/kubernetes/storage/v1/storageclass/delete.go b/internal/resources/storage/v1/storageclass/delete.go similarity index 100% rename from internal/kubernetes/storage/v1/storageclass/delete.go rename to internal/resources/storage/v1/storageclass/delete.go diff --git a/internal/kubernetes/storage/v1/storageclass/generate.go b/internal/resources/storage/v1/storageclass/generate.go similarity index 100% rename from internal/kubernetes/storage/v1/storageclass/generate.go rename to internal/resources/storage/v1/storageclass/generate.go diff --git a/internal/kubernetes/storage/v1/storageclass/read.go b/internal/resources/storage/v1/storageclass/read.go similarity index 100% rename from internal/kubernetes/storage/v1/storageclass/read.go rename to internal/resources/storage/v1/storageclass/read.go diff --git a/internal/kubernetes/storage/v1/storageclass/resource.go b/internal/resources/storage/v1/storageclass/resource.go similarity index 100% rename from internal/kubernetes/storage/v1/storageclass/resource.go rename to internal/resources/storage/v1/storageclass/resource.go diff --git a/internal/kubernetes/storage/v1/storageclass/update.go b/internal/resources/storage/v1/storageclass/update.go similarity index 100% rename from internal/kubernetes/storage/v1/storageclass/update.go rename to internal/resources/storage/v1/storageclass/update.go diff --git a/provider.go b/provider.go index 36362034..92e787fb 100644 --- a/provider.go +++ b/provider.go @@ -3,91 +3,17 @@ package main import ( "github.com/hashicorp/terraform/helper/schema" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/apiextensions/v1beta1/crd" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/apiregistration/v1beta1/apiservice" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/apps/v1/daemonset" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/apps/v1/deployment" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/apps/v1/statefulset" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/configmap" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/namespace" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/secret" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/service" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/core/v1/serviceaccount" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/policy/v1beta1/poddisruptionbudget" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/rbac/v1/clusterrole" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/rbac/v1/clusterrolebinding" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/rbac/v1/role" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/rbac/v1/rolebinding" - "github.com/previousnext/terraform-provider-k8s/internal/kubernetes/storage/v1/storageclass" + "github.com/previousnext/terraform-provider-k8s/internal/datasources" + "github.com/previousnext/terraform-provider-k8s/internal/resources" "github.com/previousnext/terraform-provider-k8s/internal/terraform/config" ) -const ( - // ResourceDeployment identifier for the Kubernetes Deployment. - ResourceDeployment = "k8s_apps_v1_deployment" - // ResourceDaemonSet identifier for the Kubernetes DaemonSet. - ResourceDaemonSet = "k8s_apps_v1_daemonset" - // ResourceStatefulSet identifier for the Kubernetes StatefulSet. - ResourceStatefulSet = "k8s_apps_v1_statefulset" - - // ResourceStorageClass identifier for the Kubernetes StorageClass. - ResourceStorageClass = "k8s_storage_v1_storageclass" - - // ResourceNamespace identifier for the Kubernetes Namespace. - ResourceNamespace = "k8s_core_v1_namespace" - // ResourceSecret identifier for the Kubernetes Secret. - ResourceSecret = "k8s_core_v1_secret" - // ResourceConfigMap identifier for the Kubernetes Secret. - ResourceConfigMap = "k8s_core_v1_configmap" - // ResourceServiceAccount identifier for the Kubernetes ServiceAccount. - ResourceServiceAccount = "k8s_core_v1_serviceaccount" - // ResourceService identifier for the Kubernetes Service. - ResourceService = "k8s_core_v1_service" - - // ResourceRole identifier for the Kubernetes Role. - ResourceRole = "k8s_rbac_v1_role" - // ResourceRoleBinding identifier for the Kubernetes RoleBinding. - ResourceRoleBinding = "k8s_rbac_v1_rolebinding" - // ResourceClusterRole identifier for the Kubernetes ClusterRole. - ResourceClusterRole = "k8s_rbac_v1_clusterrole" - // ResourceClusterRoleBinding identifier for the Kubernetes ClusterRoleBinding. - ResourceClusterRoleBinding = "k8s_rbac_v1_clusterrolebinding" - - // ResourceCustomtResourceDefinition identifier for the Kubernetes CustomtResourceDefinition. - ResourceCustomtResourceDefinition = "k8s_apiextensions_v1beta1_customresourcedefinition" - - // ResourceAPIService identifier for the Kubernetes APIService. - ResourceAPIService = "k8s_apiregistration_v1beta1_apiservice" - - // ResourcePodDisruptionBudget identifier for the Kubernetes PodDisruptionBudget. - ResourcePodDisruptionBudget = "k8s_policy_v1beta1_poddisruptionbudget" -) - // Provider returns this providers resources. func Provider() *schema.Provider { return &schema.Provider{ - Schema: config.Fields(), - DataSourcesMap: map[string]*schema.Resource{ - ResourceService: service.Source(), - }, - ResourcesMap: map[string]*schema.Resource{ - ResourceNamespace: namespace.Resource(), - ResourceDeployment: deployment.Resource(), - ResourceDaemonSet: daemonset.Resource(), - ResourceStatefulSet: statefulset.Resource(), - ResourceStorageClass: storageclass.Resource(), - ResourceServiceAccount: serviceaccount.Resource(), - ResourceService: service.Resource(), - ResourceSecret: secret.Resource(), - ResourceConfigMap: configmap.Resource(), - ResourceRole: role.Resource(), - ResourceRoleBinding: rolebinding.Resource(), - ResourceClusterRole: clusterrole.Resource(), - ResourceClusterRoleBinding: clusterrolebinding.Resource(), - ResourceCustomtResourceDefinition: crd.Resource(), - ResourceAPIService: apiservice.Resource(), - ResourcePodDisruptionBudget: poddisruptionbudget.Resource(), - }, - ConfigureFunc: config.Func, + Schema: config.Fields(), + DataSourcesMap: datasources.DataSourcesMap(), + ResourcesMap: resources.ResourcesMap(), + ConfigureFunc: config.Func, } }