Skip to content

Commit

Permalink
INFRA-35677: Update v2 workspace to handle spec.tags (#332)
Browse files Browse the repository at this point in the history
Co-authored-by: Nick <[email protected]>
  • Loading branch information
nabadger and nickmintel authored Jun 7, 2024
1 parent 3b16cbb commit 5e215eb
Show file tree
Hide file tree
Showing 8 changed files with 412 additions and 63 deletions.
7 changes: 7 additions & 0 deletions charts/terraform-cloud/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v1.7.0] - 2024-06-07
### Changed
- Update v2 workspace to configure `spec.tags`

### Removed
- Remove v2 workspace custom-extension annotations (will be handled by `spec.tags` and `spec.teamAccess`)

## [v1.6.0] - 2024-06-06
### Added
- Added IRSA tests for workspace-v2 (copied and adjust v1 version)
Expand Down
2 changes: 1 addition & 1 deletion charts/terraform-cloud/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ 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: 1.6.0
version: 1.7.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
Expand Down
2 changes: 1 addition & 1 deletion charts/terraform-cloud/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# terraform-cloud

![Version: 1.6.0](https://img.shields.io/badge/Version-1.6.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.0.0](https://img.shields.io/badge/AppVersion-2.0.0-informational?style=flat-square)
![Version: 1.7.0](https://img.shields.io/badge/Version-1.7.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.0.0](https://img.shields.io/badge/AppVersion-2.0.0-informational?style=flat-square)

A Helm chart for provisioning resources using Terraform Cloud

Expand Down
7 changes: 6 additions & 1 deletion charts/terraform-cloud/templates/helpers/_workspace-v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ metadata:
app.kubernetes.io/name: {{ printf "%s-%s" ($instanceCfg.name | kebabcase) ($resourceType | kebabcase) | trunc 63 }}
annotations:
{{ include "mintel_common.commonAnnotations" $ | nindent 4 }}
{{ include "mintel_common.terraform_cloud.tfCloudOperatorExtentionAnnotations" $workspaceDict | nindent 4 }}
{{- if (eq $resourceType "irsa") }}
app.mintel.com/altManifestFileSuffix: "{{ $global.name }}-{{ $resourceType | kebabcase }}"
{{- else }}
Expand All @@ -47,6 +46,12 @@ spec:
key: token
sshKey:
name: "mintel-ssh"
tags:
- env:{{ $global.clusterEnv }}
- owner:{{ $global.owner | lower }}
- mod:{{ $resourceType }}
- allow-destroy:{{ (include "mintel_common.terraform_cloud.allow_destroy" $workspaceDict) }}
- kubernetes-managed
terraformVersion: {{ $tfVersion | default $global.terraform.terraformVersion | quote }}
{{- if (has $resourceType (list "irsa" "extraIAM" )) }}
runTriggers:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ IRSA created explicitly:
annotations:
app.mintel.com/altManifestFileSuffix: test-app-irsa
app.mintel.com/placeholder: placeholder
app.mintel.com/terraform-allow-destroy: "true"
app.mintel.com/terraform-cloud-tags: env:dev,owner:sre,mod:irsa
app.mintel.com/terraform-owner: sre
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
argocd.argoproj.io/sync-wave: "-20"
labels:
Expand Down Expand Up @@ -38,6 +35,12 @@ IRSA created explicitly:
runTriggers: null
sshKey:
name: mintel-ssh
tags:
- env:dev
- owner:sre
- mod:irsa
- allow-destroy:true
- kubernetes-managed
terraformVariables:
- hcl: false
name: aws_account_name
Expand Down Expand Up @@ -130,9 +133,6 @@ IRSA created for Dev S3 module workspace:
annotations:
app.mintel.com/altManifestFileSuffix: test-app-irsa
app.mintel.com/placeholder: placeholder
app.mintel.com/terraform-allow-destroy: "true"
app.mintel.com/terraform-cloud-tags: env:dev,owner:sre,mod:irsa
app.mintel.com/terraform-owner: sre
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
argocd.argoproj.io/sync-wave: "-20"
labels:
Expand Down Expand Up @@ -163,6 +163,12 @@ IRSA created for Dev S3 module workspace:
- name: dev-eu-west-1-cluster1-test-namespace-mntl-test-app-s3
sshKey:
name: mintel-ssh
tags:
- env:dev
- owner:sre
- mod:irsa
- allow-destroy:true
- kubernetes-managed
terraformVariables:
- hcl: false
name: aws_account_name
Expand Down Expand Up @@ -255,9 +261,6 @@ IRSA created with default (0) syncWave:
annotations:
app.mintel.com/altManifestFileSuffix: test-app-irsa
app.mintel.com/placeholder: placeholder
app.mintel.com/terraform-allow-destroy: "true"
app.mintel.com/terraform-cloud-tags: env:dev,owner:sre,mod:irsa
app.mintel.com/terraform-owner: sre
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
argocd.argoproj.io/sync-wave: "0"
labels:
Expand Down Expand Up @@ -287,6 +290,12 @@ IRSA created with default (0) syncWave:
runTriggers: null
sshKey:
name: mintel-ssh
tags:
- env:dev
- owner:sre
- mod:irsa
- allow-destroy:true
- kubernetes-managed
terraformVariables:
- hcl: false
name: aws_account_name
Expand Down Expand Up @@ -379,9 +388,6 @@ IRSA created with modified syncWave:
annotations:
app.mintel.com/altManifestFileSuffix: test-app-irsa
app.mintel.com/placeholder: placeholder
app.mintel.com/terraform-allow-destroy: "true"
app.mintel.com/terraform-cloud-tags: env:dev,owner:sre,mod:irsa
app.mintel.com/terraform-owner: sre
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
argocd.argoproj.io/sync-wave: "-100"
labels:
Expand Down Expand Up @@ -411,6 +417,12 @@ IRSA created with modified syncWave:
runTriggers: null
sshKey:
name: mintel-ssh
tags:
- env:dev
- owner:sre
- mod:irsa
- allow-destroy:true
- kubernetes-managed
terraformVariables:
- hcl: false
name: aws_account_name
Expand Down
27 changes: 18 additions & 9 deletions charts/terraform-cloud/tests/__snapshot__/module-v2_test.yaml.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ Test module defaults:
annotations:
app.mintel.com/altManifestFileSuffix: mntl-test-workspace-s3
app.mintel.com/placeholder: placeholder
app.mintel.com/terraform-allow-destroy: "true"
app.mintel.com/terraform-cloud-tags: env:dev,owner:sre,mod:s3
app.mintel.com/terraform-owner: sre
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
argocd.argoproj.io/sync-wave: "-40"
labels:
Expand All @@ -29,6 +26,12 @@ Test module defaults:
organization: Mintel
sshKey:
name: mintel-ssh
tags:
- env:dev
- owner:sre
- mod:s3
- allow-destroy:true
- kubernetes-managed
terraformVariables:
- hcl: false
name: aws_account_name
Expand Down Expand Up @@ -126,9 +129,6 @@ Test module overrides:
annotations:
app.mintel.com/altManifestFileSuffix: mntl-test-workspace-s3
app.mintel.com/placeholder: placeholder
app.mintel.com/terraform-allow-destroy: "true"
app.mintel.com/terraform-cloud-tags: env:dev,owner:sre,mod:s3
app.mintel.com/terraform-owner: sre
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
argocd.argoproj.io/sync-wave: "-40"
labels:
Expand All @@ -149,6 +149,12 @@ Test module overrides:
organization: Mintel
sshKey:
name: mintel-ssh
tags:
- env:dev
- owner:sre
- mod:s3
- allow-destroy:true
- kubernetes-managed
terraformVariables:
- hcl: false
name: aws_account_name
Expand Down Expand Up @@ -246,9 +252,6 @@ Test module restartedAt disabled:
annotations:
app.mintel.com/altManifestFileSuffix: mntl-test-workspace-s3
app.mintel.com/placeholder: placeholder
app.mintel.com/terraform-allow-destroy: "true"
app.mintel.com/terraform-cloud-tags: env:dev,owner:sre,mod:s3
app.mintel.com/terraform-owner: sre
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
argocd.argoproj.io/sync-wave: "-40"
labels:
Expand All @@ -269,6 +272,12 @@ Test module restartedAt disabled:
organization: Mintel
sshKey:
name: mintel-ssh
tags:
- env:dev
- owner:sre
- mod:s3
- allow-destroy:true
- kubernetes-managed
terraformVariables:
- hcl: false
name: aws_account_name
Expand Down
Loading

0 comments on commit 5e215eb

Please sign in to comment.