Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

terraform upgrade to 1.5.7 #1998

Merged
merged 11 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/_nebari/constants.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
CURRENT_RELEASE = "2023.7.2"

TERRAFORM_VERSION = "1.0.5"
# NOTE: Terraform cannot be upgraded further due to Hashicorp licensing changes
# implemented in August 2023.
# https://www.hashicorp.com/license-faq
TERRAFORM_VERSION = "1.5.7"

# 04-kubernetes-ingress
DEFAULT_TRAEFIK_IMAGE_TAG = "2.9.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ output "kubernetes_credentials" {
description = "Parameters needed to connect to kubernetes cluster locally"
sensitive = true
value = {
config_path = var.kubeconfig_filename
iameskild marked this conversation as resolved.
Show resolved Hide resolved
host = kind_cluster.default.endpoint
cluster_ca_certificate = kind_cluster.default.cluster_ca_certificate
client_key = kind_cluster.default.client_key
Expand Down
10 changes: 9 additions & 1 deletion src/_nebari/stages/terraform_state/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,15 @@ def state_imports(self) -> List[Tuple[str, str]]:
return []

def tf_objects(self) -> List[Dict]:
if self.config.provider == schema.ProviderEnum.aws:
if self.config.provider == schema.ProviderEnum.gcp:
return [
terraform.Provider(
"google",
project=self.config.google_cloud_platform.project,
region=self.config.google_cloud_platform.region,
),
]
elif self.config.provider == schema.ProviderEnum.aws:
return [
terraform.Provider(
"aws", region=self.config.amazon_web_services.region
Expand Down
18 changes: 18 additions & 0 deletions tests/tests_unit/test_dependencies.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import subprocess
import urllib
from pathlib import Path

import pytest

from _nebari.provider import terraform

SRC_DIR = Path(__file__).parent.parent.parent
PYPROJECT = SRC_DIR / "pyproject.toml"

Expand Down Expand Up @@ -63,3 +66,18 @@ def test_build_by_conda_forge(tmp_path):
except subprocess.CalledProcessError as e:
print(e.stderr.decode("utf-8"))
raise e


def test_terraform_open_source_license():
tf_version = terraform.version()
license_url = (
f"https://raw.githubusercontent.com/hashicorp/terraform/v{tf_version}/LICENSE"
)

request = urllib.request.Request(license_url)
with urllib.request.urlopen(request) as response:
assert 200 == response.getcode()

license = str(response.read())
assert "Mozilla Public License" in license
assert "Business Source License" not in license