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

support ghpc_stage function in kubectl-apply module #3036

Merged
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
6 changes: 3 additions & 3 deletions modules/management/kubectl-apply/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ This module simplifies applying Kubernetes manifests to GKE clusters. It provide
metadata:
name: my-namespace
- source: "https://github.com/kubernetes-sigs/jobset/releases/download/v0.6.0/manifests.yaml"
- source: "./manifests/configmap1.yaml"
- source: "./manifests/configmap2.yaml.tftpl"
- source: $(ghpc_stage("manifests/configmap1.yaml"))
- source: $(ghpc_stage("manifests/configmap2.yaml.tftpl"))
template_vars: {name: "dev-config", public: "false"}
- source: "./manifests/"
- source: $(ghpc_stage("manifests"))/
template_vars: {name: "dev-config", public: "false"}
```

Expand Down
4 changes: 2 additions & 2 deletions modules/management/kubectl-apply/kubectl/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ locals {
url = startswith(local.null_safe_source, "http://") || startswith(local.null_safe_source, "https://") ? var.source_path : null
url_content = local.url != null ? data.http.yaml_content[0].response_body : null

yaml_file = local.url == null && endswith(lower(local.null_safe_source), ".yaml") ? abspath(var.source_path) : null
yaml_file = local.url == null && length(regexall("\\.yaml(_.*)?$", lower(local.null_safe_source))) == 1 ? abspath(var.source_path) : null
yaml_file_content = local.yaml_file != null ? file(local.yaml_file) : null

template_file = local.url == null && endswith(lower(local.null_safe_source), ".tftpl") ? abspath(var.source_path) : null
template_file = local.url == null && length(regexall("\\.tftpl(_.*)?$", lower(local.null_safe_source))) == 1 ? abspath(var.source_path) : null
template_file_content = local.template_file != null ? templatefile(local.template_file, var.template_vars) : null

yaml_body = coalesce(local.content_yaml_body, local.url_content, local.yaml_file_content, local.template_file_content, " ")
Expand Down
Loading