From 950f3d17c1e5973ad93a150bd08fecc496dba305 Mon Sep 17 00:00:00 2001 From: smokestacklightnin <125844868+smokestacklightnin@users.noreply.github.com> Date: Sat, 23 Nov 2024 18:39:47 -0800 Subject: [PATCH] Add missing imports --- src/_nebari/stages/infrastructure/__init__.py | 13 +++++++------ src/_nebari/stages/kubernetes_ingress/__init__.py | 6 +++++- src/_nebari/stages/kubernetes_keycloak/__init__.py | 6 +++++- .../kubernetes_keycloak_configuration/__init__.py | 1 + src/_nebari/stages/kubernetes_services/__init__.py | 6 +++++- .../stages/nebari_tf_extensions/__init__.py | 6 +++++- src/_nebari/stages/terraform_state/__init__.py | 14 +++++++++----- src/_nebari/stages/tf_objects.py | 1 + 8 files changed, 38 insertions(+), 15 deletions(-) diff --git a/src/_nebari/stages/infrastructure/__init__.py b/src/_nebari/stages/infrastructure/__init__.py index 53cd10349a..84c622f45a 100644 --- a/src/_nebari/stages/infrastructure/__init__.py +++ b/src/_nebari/stages/infrastructure/__init__.py @@ -15,6 +15,7 @@ from _nebari.provider.cloud import amazon_web_services, azure_cloud, google_cloud from _nebari.stages.base import NebariTerraformStage from _nebari.stages.kubernetes_services import SharedFsEnum +from _nebari.stages.tf_objects import NebariOpentofuRequiredProvider from _nebari.utils import ( AZURE_NODE_RESOURCE_GROUP_SUFFIX, construct_azure_resource_group_name, @@ -702,7 +703,7 @@ def tf_objects(self) -> List[Dict]: if self.config.provider == schema.ProviderEnum.gcp: return [ *resources, - opentofu.RequiredProvider(**constants.REQUIRED_PROVIDERS["google"]), + NebariOpentofuRequiredProvider("google", self.config), opentofu.Provider( "google", project=self.config.google_cloud_platform.project, @@ -712,20 +713,20 @@ def tf_objects(self) -> List[Dict]: elif self.config.provider == schema.ProviderEnum.azure: return [ *resources, - opentofu.RequiredProvider(**constants.REQUIRED_PROVIDERS["azure"]), + NebariOpentofuRequiredProvider("azurerm", self.config), ] elif self.config.provider == schema.ProviderEnum.aws: return [ *resources, - opentofu.RequiredProvider(**constants.REQUIRED_PROVIDERS["aws"]), + NebariOpentofuRequiredProvider("aws", self.config), opentofu.Provider("aws", region=self.config.amazon_web_services.region), ] elif self.config.provider == schema.ProviderEnum.local: return [ *resource, - opentofu.RequiredProvider(**constants.REQUIRED_PROVIDERS["kind"]), - opentofu.RequiredProvider(**constants.REQUIRED_PROVIDERS["docker"]), - opentofu.RequiredProvider(**constants.REQUIRED_PROVIDERS["kubectl"]), + NebariOpentofuRequiredProvider("kind", self.config), + NebariOpentofuRequiredProvider("docker", self.config), + NebariOpentofuRequiredProvider("kubectl", self.config), ] else: return resources diff --git a/src/_nebari/stages/kubernetes_ingress/__init__.py b/src/_nebari/stages/kubernetes_ingress/__init__.py index af78723b9f..4f324f2285 100644 --- a/src/_nebari/stages/kubernetes_ingress/__init__.py +++ b/src/_nebari/stages/kubernetes_ingress/__init__.py @@ -8,7 +8,11 @@ from _nebari import constants from _nebari.provider.dns.cloudflare import update_record from _nebari.stages.base import NebariTerraformStage -from _nebari.stages.tf_objects import NebariHelmProvider, NebariKubernetesProvider +from _nebari.stages.tf_objects import ( + NebariHelmProvider, + NebariKubernetesProvider, + NebariOpentofuRequiredProvider, +) from nebari import schema from nebari.hookspecs import NebariStage, hookimpl diff --git a/src/_nebari/stages/kubernetes_keycloak/__init__.py b/src/_nebari/stages/kubernetes_keycloak/__init__.py index 9fced72978..1ecc483016 100644 --- a/src/_nebari/stages/kubernetes_keycloak/__init__.py +++ b/src/_nebari/stages/kubernetes_keycloak/__init__.py @@ -11,7 +11,11 @@ from pydantic import Field, ValidationInfo, field_validator from _nebari.stages.base import NebariTerraformStage -from _nebari.stages.tf_objects import NebariHelmProvider, NebariKubernetesProvider +from _nebari.stages.tf_objects import ( + NebariHelmProvider, + NebariKubernetesProvider, + NebariOpentofuRequiredProvider, +) from _nebari.utils import modified_environ from nebari import schema from nebari.hookspecs import NebariStage, hookimpl diff --git a/src/_nebari/stages/kubernetes_keycloak_configuration/__init__.py b/src/_nebari/stages/kubernetes_keycloak_configuration/__init__.py index 025a65eba1..3fee998ef1 100644 --- a/src/_nebari/stages/kubernetes_keycloak_configuration/__init__.py +++ b/src/_nebari/stages/kubernetes_keycloak_configuration/__init__.py @@ -4,6 +4,7 @@ from _nebari.stages.base import NebariTerraformStage from _nebari.stages.kubernetes_keycloak import Authentication +from _nebari.stages.tf_objects import NebariOpentofuRequiredProvider from nebari import schema from nebari.hookspecs import NebariStage, hookimpl diff --git a/src/_nebari/stages/kubernetes_services/__init__.py b/src/_nebari/stages/kubernetes_services/__init__.py index 5c7dcb2137..2c96b96f17 100644 --- a/src/_nebari/stages/kubernetes_services/__init__.py +++ b/src/_nebari/stages/kubernetes_services/__init__.py @@ -10,7 +10,11 @@ from _nebari import constants from _nebari.stages.base import NebariTerraformStage -from _nebari.stages.tf_objects import NebariHelmProvider, NebariKubernetesProvider +from _nebari.stages.tf_objects import ( + NebariHelmProvider, + NebariKubernetesProvider, + NebariOpentofuRequiredProvider, +) from _nebari.utils import ( byte_unit_conversion, set_docker_image_tag, diff --git a/src/_nebari/stages/nebari_tf_extensions/__init__.py b/src/_nebari/stages/nebari_tf_extensions/__init__.py index fb4146862b..3618e6bb98 100644 --- a/src/_nebari/stages/nebari_tf_extensions/__init__.py +++ b/src/_nebari/stages/nebari_tf_extensions/__init__.py @@ -1,7 +1,11 @@ from typing import Any, Dict, List, Optional, Type from _nebari.stages.base import NebariTerraformStage -from _nebari.stages.tf_objects import NebariHelmProvider, NebariKubernetesProvider +from _nebari.stages.tf_objects import ( + NebariHelmProvider, + NebariKubernetesProvider, + NebariOpentofuRequiredProvider, +) from nebari import schema from nebari.hookspecs import NebariStage, hookimpl diff --git a/src/_nebari/stages/terraform_state/__init__.py b/src/_nebari/stages/terraform_state/__init__.py index 3278c49726..f257cd2625 100644 --- a/src/_nebari/stages/terraform_state/__init__.py +++ b/src/_nebari/stages/terraform_state/__init__.py @@ -8,11 +8,15 @@ from pydantic import BaseModel, field_validator -from _nebari import constants, utils +from _nebari import utils from _nebari.provider import opentofu from _nebari.provider.cloud import azure_cloud from _nebari.stages.base import NebariTerraformStage -from _nebari.stages.tf_objects import NebariConfig, NebariOpentofuRequiredVersion +from _nebari.stages.tf_objects import ( + NebariConfig, + NebariOpentofuRequiredProvider, + NebariOpentofuRequiredVersion, +) from _nebari.utils import ( AZURE_TF_STATE_RESOURCE_GROUP_SUFFIX, construct_azure_resource_group_name, @@ -166,7 +170,7 @@ def tf_objects(self) -> List[Dict]: if self.config.provider == schema.ProviderEnum.gcp: return [ *resources, - opentofu.RequiredProvider(**constants.REQUIRED_PROVIDERS["google"]), + NebariOpentofuRequiredProvider("google", self.config), opentofu.Provider( "google", project=self.config.google_cloud_platform.project, @@ -176,13 +180,13 @@ def tf_objects(self) -> List[Dict]: elif self.config.provider == schema.ProviderEnum.aws: return [ *resources, - opentofu.RequiredProvider(**constants.REQUIRED_PROVIDERS["aws"]), + NebariOpentofuRequiredProvider("aws", self.config), opentofu.Provider("aws", region=self.config.amazon_web_services.region), ] elif self.config.provider == schema.ProviderEnum.azure: return [ *resources, - opentofu.RequiredProvider(**constants.REQUIRED_PROVIDERS["azurerem"]), + NebariOpentofuRequiredProvider("azurerm", self.config), ] else: return resources diff --git a/src/_nebari/stages/tf_objects.py b/src/_nebari/stages/tf_objects.py index 99a7934067..bcbbc5a2fc 100644 --- a/src/_nebari/stages/tf_objects.py +++ b/src/_nebari/stages/tf_objects.py @@ -2,6 +2,7 @@ from _nebari.provider.opentofu import ( Data, Provider, + RequiredProvider, Resource, Terraform, TerraformBackend,