diff --git a/.github/workflows/terraform-release.yaml b/.github/workflows/terraform-release.yaml index 90910bc..3f67574 100644 --- a/.github/workflows/terraform-release.yaml +++ b/.github/workflows/terraform-release.yaml @@ -1,4 +1,4 @@ -name: Terraform CI/CD +name: Terraform Module Release on: workflow_dispatch: pull_request: @@ -6,8 +6,8 @@ on: branches: - main jobs: - terraform-ci-cd: - runs-on: 229685449397 + terraform-release: + runs-on: "229685449397" permissions: contents: write @@ -15,11 +15,6 @@ jobs: - name: Checkout code uses: CSVD/gh-actions-checkout@v4 - - name: Setup Terraform - uses: CSVD/gh-actions-setup-terraform@v3 - with: - terraform_version: "1.9.1" - - name: Setup GITHUB Credentials id: github_credentials uses: CSVD/gh-auth@main @@ -28,28 +23,6 @@ jobs: github_app_installation_id: ${{ vars.GH_APP_INSTALLATION_ID }} github_app_id: ${{ vars.GH_APP_ID }} - - - name: Debug Authentication - run: | - # Print the GitHub server URL - echo "GitHub Server URL: ${{ github.server_url }}" - - # Extract the host from the URL - HOST="${{ github.server_url }}" - HOST="${HOST#*//}" - HOST="${HOST%%/*}" - echo "GitHub Host: $HOST" - - # Check if token exists - if [[ -n "${{ steps.github_credentials.outputs.github_token }}" ]]; then - echo "Token generated successfully" - # Test the token with a simple GitHub API call (without exposing the token) - STATUS=$(curl -s -o /dev/null -w "%{http_code}" -H "Authorization: Bearer ${{ steps.github_credentials.outputs.github_token }}" "${{ github.server_url }}/api/v3/user") - echo "API Test Status Code: $STATUS" - else - echo "No token was generated!" - fi - - name: Setup GitHub CLI run: | # Force manual authentication since setup-git might not work with GitHub Enterprise @@ -60,14 +33,8 @@ jobs: # Test GitHub CLI auth status gh auth status || echo "GitHub CLI authentication failed" - - name: AWS Auth - id: aws_auth - uses: CSVD/aws-auth@main - with: - ecs: true - - - name: Run Terraform Module Release Action - uses: CSVD/terraform-module-release@main + - name: Run Release Action + uses: CSVD/releaser@main with: github-token: ${{ steps.github_credentials.outputs.github_token }} working-directory: '.' diff --git a/.github/workflows/terraform-validate.yaml b/.github/workflows/terraform-validate.yaml index 72829d8..ac349eb 100644 --- a/.github/workflows/terraform-validate.yaml +++ b/.github/workflows/terraform-validate.yaml @@ -16,7 +16,7 @@ jobs: - name: Setup Terraform uses: CSVD/gh-actions-setup-terraform@v2 with: - terraform_version: '1.7.3' + terraform_version: '1.10.5' - name: Validate Terraform Configuration id: validate diff --git a/README.md b/README.md index d64fc99..8404268 100644 --- a/README.md +++ b/README.md @@ -1,49 +1,66 @@ # tfmod-kiali +Kiali is a web console for the Istio Service Mesh. It is analogous to how the Kubernetes Dashboard is a web console for Kubernetes, ie. it is a web interface for viewing configurations and operations of the system. Additionally, the same as the Kubernetes Dashboard, we deploy Kiali in a read-only manner, given mesh objects should only be configured through code and pipelines, not modification through web or command line. Kiali provides a useful tool for reviewing configurations and topology, observing mesh health and performance, and tracing along with its associated details. Additional details about Kiali can be reviewed at the [Kiali website](https://kiali.io/). + +This module deploys and configures Kiali via its operator and integrates it with Istio and the other telemetry oriented tools of the cluster. + ## Requirements | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 0.13 | +| [aws](#requirement\_aws) | >= 5.14.0 | | [helm](#requirement\_helm) | >= 2.11.0 | | [kubernetes](#requirement\_kubernetes) | >= 2.23.0 | +| [null](#requirement\_null) | >= 3.2.1 | ## Providers | Name | Version | |------|---------| +| [aws](#provider\_aws) | 5.94.1 | +| [aws.eecr](#provider\_aws.eecr) | 5.94.1 | | [helm](#provider\_helm) | 2.17.0 | +| [null](#provider\_null) | 3.2.3 | ## Modules | Name | Source | Version | |------|--------|---------| | [images](#module\_images) | git::https://github.e.it.census.gov/terraform-modules/aws-ecr-copy-images.git/ | tf-upgrade | -| [ingress\_resources](#module\_ingress\_resources) | git::https://github.e.it.census.gov/SCT-Engineering/tfmod-istio-service-ingress.git | main | ## Resources | Name | Type | |------|------| +| [helm_release.kiali](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | | [helm_release.kiali_operator](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | +| [null_resource.git_version](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource | +| [aws_ecr_authorization_token.ecr_token](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ecr_authorization_token) | data source | +| [aws_ecr_authorization_token.token](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ecr_authorization_token) | data source | ## Inputs | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| +| [account\_id](#input\_account\_id) | aws account number | `string` | `""` | no | | [cluster\_domain](#input\_cluster\_domain) | The domain name used to reference ingresses for the cluster | `string` | n/a | yes | | [cluster\_name](#input\_cluster\_name) | The name of the cluster into which the tools are deployed. | `string` | n/a | yes | +| [eecr\_info](#input\_eecr\_info) | Enterprise ECR source information |
object({
account_id = string
alias = string
profile = string
region = string
})
|
{
"account_id": "269222635945",
"alias": "lab-gov-shared-nonprod",
"profile": "269222635945-lab-gov-shared-nonprod",
"region": "us-gov-east-1"
}
| no | | [grafana\_internal\_url](#input\_grafana\_internal\_url) | The url within the cluster to use to access grafana. | `string` | n/a | yes | -| [grafana\_public\_url](#input\_grafana\_public\_url) | The URL incoming traffic from outisde the cluster uses to access grafana. | `string` | n/a | yes | | [grafana\_secret\_name](#input\_grafana\_secret\_name) | The secret in the holding the grafana admin password. | `string` | n/a | yes | +| [grafana\_service\_name](#input\_grafana\_service\_name) | The name of the service used for grafana. | `string` | `"grafana"` | no | | [istio\_namespace](#input\_istio\_namespace) | The namespace where istio has been deployed. | `string` | `"istio-system"` | no | | [kiali\_application\_version](#input\_kiali\_application\_version) | The version of kiali to install | `string` | `"v1.73.0"` | no | | [kiali\_operator\_version](#input\_kiali\_operator\_version) | The version of kiali to install | `string` | `"1.73.0"` | no | | [namespace](#input\_namespace) | The namespace to create and into which the tools are deployed. | `string` | `"namespace"` | no | | [profile](#input\_profile) | The AWS\_PROFILE to use while running the scripts. | `string` | `""` | no | | [prometheus\_internal\_url](#input\_prometheus\_internal\_url) | The url within the cluster to use to query the prometheus server. | `string` | n/a | yes | +| [region](#input\_region) | region name | `string` | `"us-gov-east-1"` | no | | [service\_name](#input\_service\_name) | The name of the service for Kiali. | `string` | `"kiali"` | no | +| [tempo\_datasource\_id](#input\_tempo\_datasource\_id) | The UID of the created Tempo datasource | `string` | n/a | yes | +| [tempo\_internal\_url](#input\_tempo\_internal\_url) | The url within the cluster to use to query tempo tracing. | `string` | n/a | yes | ## Outputs @@ -52,5 +69,5 @@ | [internal\_endpoint](#output\_internal\_endpoint) | The internal endpoint to use to access kiali | | [module\_name](#output\_module\_name) | The name of this module. | | [module\_version](#output\_module\_version) | The version of this module. | -| [public\_endpoint](#output\_public\_endpoint) | The endpoint at which keycloak can be reached from outside the cluster. | +| [namespace](#output\_namespace) | The namespace in which kiali gets installed in. | diff --git a/copy_images.tf b/copy_images.tf index b26ad1f..d321b82 100644 --- a/copy_images.tf +++ b/copy_images.tf @@ -1,6 +1,7 @@ locals { kiali_operator_key = format("%v#%v", "istio-tools/kiali-operator", var.kiali_application_version) kiali_server_key = format("%v#%v", "istio-tools/kiali", var.kiali_application_version) + ent_ecr_source = format("%v.%v.%v.%v", var.eecr_info.account_id, "dkr.ecr", var.region, "amazonaws.com/ent-images") image_config = [ ## Images for Kiali @@ -9,7 +10,7 @@ locals { dest_path = null name = "istio-tools/kiali-operator" source_image = "kiali/kiali-operator" - source_registry = "quay.io" + source_registry = format("%v/%v", local.ent_ecr_source, "quay") source_tag = var.kiali_application_version tag = var.kiali_application_version }, @@ -18,7 +19,7 @@ locals { dest_path = null name = "istio-tools/kiali" source_image = "kiali/kiali" - source_registry = "quay.io" + source_registry = format("%v/%v", local.ent_ecr_source, "quay") source_tag = var.kiali_application_version tag = var.kiali_application_version }, @@ -33,7 +34,29 @@ module "images" { image_config = local.image_config tags = {} - enable_lifecycle_policy = true - lifecycle_policy_all = true - force_delete = true + enable_lifecycle_policy = true + lifecycle_policy_all = true + force_delete = true + lifecycle_policy_keep_count = 5 + + source_username = data.aws_ecr_authorization_token.ecr_token.user_name + source_password = data.aws_ecr_authorization_token.ecr_token.password + + destination_username = data.aws_ecr_authorization_token.token.user_name + destination_password = data.aws_ecr_authorization_token.token.password +} + +data "aws_ecr_authorization_token" "token" { + registry_id = var.account_id +} + +data "aws_ecr_authorization_token" "ecr_token" { + provider = aws.eecr + registry_id = var.eecr_info.account_id +} + +provider "aws" { + alias = "eecr" + profile = var.eecr_info.profile + region = var.eecr_info.region } diff --git a/kiali-operator/Chart.yaml b/kiali-operator/Chart.yaml index b447748..e1a90ab 100644 --- a/kiali-operator/Chart.yaml +++ b/kiali-operator/Chart.yaml @@ -1,20 +1,19 @@ apiVersion: v2 -appVersion: v2.7.1 -description: Kiali is an open source project for service mesh observability, refer - to https://www.kiali.io for details. +name: kiali-operator +description: Kiali is an open source project for service mesh observability, refer to https://www.kiali.io for details. +version: 0.0.0 +appVersion: 0.0.0 home: https://github.com/kiali/kiali-operator -icon: https://raw.githubusercontent.com/kiali/kiali.io/current/assets/icons/logo.svg +maintainers: +- name: Kiali + email: kiali-users@googlegroups.com + url: https://kiali.io keywords: - istio - kiali - operator -maintainers: -- email: kiali-users@googlegroups.com - name: Kiali - url: https://kiali.io -name: kiali-operator sources: - https://github.com/kiali/kiali - https://github.com/kiali/kiali-operator - https://github.com/kiali/helm-charts -version: 2.7.1 +icon: https://raw.githubusercontent.com/kiali/kiali.io/current/assets/icons/logo.svg diff --git a/kiali-operator/templates/_helpers.tpl b/kiali-operator/templates/_helpers.tpl index 23392fe..195d39b 100644 --- a/kiali-operator/templates/_helpers.tpl +++ b/kiali-operator/templates/_helpers.tpl @@ -36,7 +36,6 @@ Common labels */}} {{- define "kiali-operator.labels" -}} helm.sh/chart: {{ include "kiali-operator.chart" . }} -app: {{ include "kiali-operator.name" . }} {{ include "kiali-operator.selectorLabels" . }} {{- if .Chart.AppVersion }} version: {{ .Chart.AppVersion | quote }} diff --git a/kiali-server/Chart.yaml b/kiali-server/Chart.yaml new file mode 100644 index 0000000..f5b6dc8 --- /dev/null +++ b/kiali-server/Chart.yaml @@ -0,0 +1,25 @@ +--- +apiVersion: v2 +name: kiali +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/kiali-server/templates/_helpers.tpl b/kiali-server/templates/_helpers.tpl new file mode 100644 index 0000000..1a082cd --- /dev/null +++ b/kiali-server/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "kiali.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "kiali.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "kiali.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "kiali.labels" -}} +helm.sh/chart: {{ include "kiali.chart" . }} +{{ include "kiali.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "kiali.selectorLabels" -}} +app.kubernetes.io/name: {{ include "kiali.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "kiali.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "kiali.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/kiali-server/templates/kiali.yaml b/kiali-server/templates/kiali.yaml new file mode 100644 index 0000000..ef6e33f --- /dev/null +++ b/kiali-server/templates/kiali.yaml @@ -0,0 +1,38 @@ +apiVersion: kiali.io/v1alpha1 +kind: Kiali +metadata: + name: {{ include "kiali.fullname" . }} + labels: + {{- include "kiali.labels" . | nindent 4 }} +spec: + istio_namespace: {{ .Values.istioNamespace }} + auth: + strategy: {{ .Values.auth.strategy }} + deployment: + cluster_wide_access: true + view_only_mode: {{ .Values.deployment.view_only_mode }} + external_services: + prometheus: + enabled: true + auth: + insecure_skip_verify: true + url: {{ .Values.prometheus.url }} + grafana: + enabled: true + auth: + insecure_skip_verify: true + # auth: + # type: basic + # username: "admin" + # password: secret:{{ .Values.grafana.secretName }}:{{ .Values.grafana.passwordKey }} + external_url: {{ .Values.grafana.externalUrl }} + internal_url: {{ .Values.grafana.internalUrl }} + tracing: + enabled: true + internal_url: {{ .Values.tracing.internalUrl }} + use_grpc: false + provider: "tempo" + tempo_config: + org_id: "1" + datasource_uid: {{ .Values.tracing.tempo_config.datasource_uid }} + url_format: "grafana" diff --git a/kiali-server/values.yaml b/kiali-server/values.yaml new file mode 100644 index 0000000..f37e21b --- /dev/null +++ b/kiali-server/values.yaml @@ -0,0 +1,35 @@ +# Default values for kiali-server. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +istioNamespace: "istio-system" + +auth: + strategy: + +deployment: + view_only_mode: + +prometheus: + enabled: true + url: + +grafana: + enabled: true + auth: + type: basic + username: "admin" + secretName: + passwordKey: + externalUrl: + internalUrl: + +tracing: + enabled: true + internalUrl: + use_grpc: false + provider: "tempo" + tempo_config: + org_id: "1" + datasource_uid: + url_format: "grafana" diff --git a/main.tf b/main.tf index 58e2d4a..6d1d9d0 100644 --- a/main.tf +++ b/main.tf @@ -1,16 +1,18 @@ locals { internal_hostname = format("%v.%v.svc.cluster.local", var.service_name, var.namespace) internal_port_number = "20001" - internal_url = format("https://%s:%s/", local.internal_hostname, local.internal_port_number) + internal_url = format("http://%s:%s/", local.internal_hostname, local.internal_port_number) + # This may seem unusual, but we cannot input/pass the grafana ingress url, since kiali is a dependency of gatekeeper + # that creates the ingress (circular dep). So, we build the ingress url here using the same variables as gatekeeper. + grafana_public_url = format("https://%s.%s", var.grafana_service_name, var.cluster_domain) } resource "helm_release" "kiali_operator" { - depends_on = [module.images] - chart = "kiali-operator" - version = var.kiali_operator_version - name = "kiali-operator" - namespace = var.namespace - repository = "./" + + chart = "./kiali-operator" + version = var.kiali_operator_version + name = "kiali-operator" + namespace = var.namespace set { name = "image.repo" @@ -58,7 +60,7 @@ resource "helm_release" "kiali_operator" { } set { name = "grafana.externalUrl" - value = var.grafana_public_url + value = local.grafana_public_url } set { name = "grafana.internalUrl" @@ -70,13 +72,45 @@ resource "helm_release" "kiali_operator" { } } -module "ingress_resources" { - depends_on = [helm_release.kiali_operator] - # tflint-ignore: terraform_module_pinned_source - source = "git::https://github.e.it.census.gov/SCT-Engineering/tfmod-istio-service-ingress.git?ref=main" - public_hostname = var.service_name - public_domain = var.cluster_domain - service_name = var.service_name - service_namespace = var.namespace - service_port = local.internal_port_number +resource "helm_release" "kiali" { + depends_on = [ + helm_release.kiali_operator, + ] + + chart = "./kiali-server" + name = "kiali" + namespace = var.namespace + + set { + name = "auth.strategy" + value = "anonymous" + } + set { + name = "deployment.view_only_mode" + value = true + } + set { + name = "istioNamespace" + value = var.istio_namespace + } + set { + name = "prometheus.url" + value = var.prometheus_internal_url + } + set { + name = "grafana.externalUrl" + value = local.grafana_public_url + } + set { + name = "grafana.internalUrl" + value = var.grafana_internal_url + } + set { + name = "tracing.internalUrl" + value = var.tempo_internal_url + } + set { + name = "tracing.tempo_config.datasource_uid" + value = var.tempo_datasource_id + } } diff --git a/outputs.tf b/outputs.tf index f221287..dca5a9a 100644 --- a/outputs.tf +++ b/outputs.tf @@ -1,7 +1,7 @@ -output "public_endpoint" { - description = "The endpoint at which keycloak can be reached from outside the cluster." - value = module.ingress_resources.service_url -} +# output "public_endpoint" { +# description = "The endpoint at which keycloak can be reached from outside the cluster." +# value = module.ingress_resources.service_url +# } output "internal_endpoint" { description = "The internal endpoint to use to access kiali" @@ -12,6 +12,11 @@ output "internal_endpoint" { } } +output "namespace" { + description = "The namespace in which kiali gets installed in." + value = var.namespace +} + ################################################################################ # Module information ################################################################################ diff --git a/requirements.tf b/requirements.tf index 5f150af..32e5c6f 100644 --- a/requirements.tf +++ b/requirements.tf @@ -2,6 +2,10 @@ terraform { required_version = ">= 0.13" required_providers { + aws = { + source = "hashicorp/aws" + version = ">= 5.14.0" + } helm = { source = "hashicorp/helm" version = ">= 2.11.0" @@ -10,5 +14,9 @@ terraform { source = "hashicorp/kubernetes" version = ">= 2.23.0" } + null = { + source = "hashicorp/null" + version = ">= 3.2.1" + } } } diff --git a/variables.tf b/variables.tf index 2af2040..881c05d 100644 --- a/variables.tf +++ b/variables.tf @@ -1,23 +1,33 @@ -variable "profile" { - description = "The AWS_PROFILE to use while running the scripts." +variable "account_id" { + description = "aws account number" type = string default = "" } -variable "cluster_name" { - description = "The name of the cluster into which the tools are deployed." - type = string -} - variable "cluster_domain" { description = "The domain name used to reference ingresses for the cluster" type = string } -variable "namespace" { - description = "The namespace to create and into which the tools are deployed." +variable "cluster_name" { + description = "The name of the cluster into which the tools are deployed." type = string - default = "namespace" +} + +variable "eecr_info" { + description = "Enterprise ECR source information" + type = object({ + account_id = string + alias = string + profile = string + region = string + }) + default = { + account_id = "269222635945" + alias = "lab-gov-shared-nonprod" + profile = "269222635945-lab-gov-shared-nonprod" + region = "us-gov-east-1" + } } variable "istio_namespace" { @@ -31,31 +41,24 @@ variable "grafana_secret_name" { type = string } -variable "grafana_public_url" { - description = "The URL incoming traffic from outisde the cluster uses to access grafana." - type = string -} - variable "grafana_internal_url" { description = "The url within the cluster to use to access grafana." type = string } -variable "prometheus_internal_url" { - description = "The url within the cluster to use to query the prometheus server." +variable "grafana_service_name" { + description = "The name of the service used for grafana." type = string + default = "grafana" } -# variable "jaeger_internal_url" { -# description = "The url within the cluster to use to query the jaegertracing." -# type = string -# } - -# variable "public_hostname" { -# description = "The hostname to use for kiali that will be publicly available" -# type = string -# default = "kiali" -# } +# See the [APP VERSION] found while determining kiali_operator_version +# helm show values kiali/kiali-operator | grep tag: +variable "kiali_application_version" { + description = "The version of kiali to install" + type = string + default = "v1.73.0" +} # helm repo add kiali https://kiali.org/helm-charts # helm search repo kiali/kiali-operator @@ -65,12 +68,28 @@ variable "kiali_operator_version" { default = "1.73.0" } -# See the [APP VERSION] found while determining kiali_operator_version -# helm show values kiali/kiali-operator | grep tag: -variable "kiali_application_version" { - description = "The version of kiali to install" +variable "namespace" { + description = "The namespace to create and into which the tools are deployed." type = string - default = "v1.73.0" + default = "namespace" +} + +variable "profile" { + description = "The AWS_PROFILE to use while running the scripts." + type = string + default = "" +} + +variable "prometheus_internal_url" { + description = "The url within the cluster to use to query the prometheus server." + type = string +} + +# tflint-ignore: terraform_unused_declarations +variable "region" { + description = "region name" + type = string + default = "us-gov-east-1" } variable "service_name" { @@ -78,3 +97,13 @@ variable "service_name" { type = string default = "kiali" } + +variable "tempo_internal_url" { + description = "The url within the cluster to use to query tempo tracing." + type = string +} + +variable "tempo_datasource_id" { + description = "The UID of the created Tempo datasource" + type = string +} diff --git a/version.tf b/version.tf index 8644a7f..35d72c7 100644 --- a/version.tf +++ b/version.tf @@ -1,4 +1,16 @@ +resource "null_resource" "git_version" { + triggers = { + # Force this to run on every apply to get the latest tag value + always_run = timestamp() + } + + provisioner "local-exec" { + command = "git describe --tags --abbrev=0 2>/dev/null || echo 'unknown' > ${path.module}/.git_tag" + on_failure = continue + } +} + locals { module_name = "tfmod-kiali" - module_version = "0.1.1" + module_version = fileexists("${path.module}/.git_tag") ? trimspace(file("${path.module}/.git_tag")) : "latest" }