Skip to content

Commit

Permalink
Merge branch 'main' into tdevelioglu/add_data_source_projects
Browse files Browse the repository at this point in the history
  • Loading branch information
tdevelioglu authored May 29, 2024
2 parents be24691 + 0cc8bab commit 4b3169b
Show file tree
Hide file tree
Showing 24 changed files with 376 additions and 132 deletions.
2 changes: 1 addition & 1 deletion .github/actions/lint-provider-tfe/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ runs:
using: composite
steps:
- name: Setup Go Environment
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: "go.mod"
cache: true
Expand Down
130 changes: 63 additions & 67 deletions .github/actions/test-provider-tfe/action.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

name: TESTS ARE TEMPOARILY DISABLED
name: Test
description: Tests terraform-provider-tfe within a matrix
inputs:
admin_configuration_token:
Expand Down Expand Up @@ -51,76 +51,72 @@ inputs:
runs:
using: composite
steps:
- name: NO-OP
- name: Set up Go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: go.mod
cache: true

- name: Sync dependencies
shell: bash
run: |
echo "Tests are skipped. Please test manually."
# - name: Set up Go
# uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
# with:
# go-version-file: go.mod
# cache: true

# - name: Sync dependencies
# shell: bash
# run: |
# go mod download
# go mod tidy
go mod download
go mod tidy
# - name: Install gotestsum
# shell: bash
# run: go install gotest.tools/gotestsum@latest
- name: Install gotestsum
shell: bash
run: go install gotest.tools/gotestsum@latest

# - name: Download artifact
# id: download-artifact
# uses: dawidd6/action-download-artifact@246dbf436b23d7c49e21a7ab8204ca9ecd1fe615 # v2.27.0
# with:
# workflow_conclusion: success
# name: junit-test-summary
# if_no_artifact_found: warn
# branch: main
- name: Download artifact
id: download-artifact
uses: dawidd6/action-download-artifact@09f2f74827fd3a8607589e5ad7f9398816f540fe # v3.1.4
with:
workflow_conclusion: success
name: junit-test-summary
if_no_artifact_found: warn
branch: main

# - name: Split acceptance tests
# id: test_split
# uses: hashicorp-forge/go-test-split-action@796beedbdb3d1bea14cad2d3057bab5c5cf15fe5 # v1.0.2
# with:
# index: ${{ inputs.matrix_index }}
# total: ${{ inputs.matrix_total }}
# junit-summary: ./ci-summary-provider.xml
# # When tests are split and run concurrently, lists_tests arg in ci.yml will skip the TestAccTFESAMLSettings_omnibus test suite
# list: ${{ inputs.list_tests }}
- name: Split acceptance tests
id: test_split
uses: hashicorp-forge/go-test-split-action@796beedbdb3d1bea14cad2d3057bab5c5cf15fe5 # v1.0.2
with:
index: ${{ inputs.matrix_index }}
total: ${{ inputs.matrix_total }}
junit-summary: ./ci-summary-provider.xml
# When tests are split and run concurrently, lists_tests arg in ci.yml will skip the TestAccTFESAMLSettings_omnibus test suite
list: ${{ inputs.list_tests }}

# - name: Run Tests
# shell: bash
# env:
# TFE_HOSTNAME: "${{ inputs.hostname }}"
# TFE_TOKEN: "${{ inputs.token }}"
# TFE_ADMIN_CONFIGURATION_TOKEN: ${{ inputs.admin_configuration_token }}
# TFE_ADMIN_PROVISION_LICENSES_TOKEN: ${{ inputs.admin_provision_licenses_token }}
# TFE_ADMIN_SECURITY_MAINTENANCE_TOKEN: ${{ inputs.admin_security_maintenance_token }}
# TFE_ADMIN_SITE_ADMIN_TOKEN: ${{ inputs.admin_site_admin_token }}
# TFE_ADMIN_SUBSCRIPTION_TOKEN: ${{ inputs.admin_subscription_token }}
# TFE_ADMIN_SUPPORT_TOKEN: ${{ inputs.admin_support_token }}
# TFE_ADMIN_VERSION_MAINTENANCE_TOKEN: ${{ inputs.admin_version_maintenance_token }}
# TFE_USER1: tfe-provider-user1
# TFE_USER2: tfe-provider-user2
# TF_ACC: "1"
# ENABLE_TFE: "${{ inputs.enterprise }}"
# RUN_TASKS_URL: "http://testing-mocks.tfe:22180/runtasks/pass"
# GITHUB_POLICY_SET_IDENTIFIER: "hashicorp/test-policy-set"
# GITHUB_REGISTRY_MODULE_IDENTIFIER: "hashicorp/terraform-random-module"
# GITHUB_WORKSPACE_IDENTIFIER: "hashicorp/terraform-random-module"
# GITHUB_WORKSPACE_BRANCH: "main"
# GITHUB_TOKEN: "${{ inputs.testing-github-token }}"
# MOD_PROVIDER: github.com/hashicorp/terraform-provider-tfe
# MOD_TFE: github.com/hashicorp/terraform-provider-tfe/internal/provider
# MOD_VERSION: github.com/hashicorp/terraform-provider-tfe/version
# run: |
# gotestsum --junitfile summary.xml --format short-verbose -- $MOD_PROVIDER $MOD_TFE $MOD_VERSION -v -timeout=30m -run "${{ steps.test_split.outputs.run }}"
- name: Run Tests
shell: bash
env:
TFE_HOSTNAME: "${{ inputs.hostname }}"
TFE_TOKEN: "${{ inputs.token }}"
TFE_ADMIN_CONFIGURATION_TOKEN: ${{ inputs.admin_configuration_token }}
TFE_ADMIN_PROVISION_LICENSES_TOKEN: ${{ inputs.admin_provision_licenses_token }}
TFE_ADMIN_SECURITY_MAINTENANCE_TOKEN: ${{ inputs.admin_security_maintenance_token }}
TFE_ADMIN_SITE_ADMIN_TOKEN: ${{ inputs.admin_site_admin_token }}
TFE_ADMIN_SUBSCRIPTION_TOKEN: ${{ inputs.admin_subscription_token }}
TFE_ADMIN_SUPPORT_TOKEN: ${{ inputs.admin_support_token }}
TFE_ADMIN_VERSION_MAINTENANCE_TOKEN: ${{ inputs.admin_version_maintenance_token }}
TFE_USER1: tfe-provider-user1
TFE_USER2: tfe-provider-user2
TF_ACC: "1"
ENABLE_TFE: "${{ inputs.enterprise }}"
RUN_TASKS_URL: "http://testing-mocks.tfe:22180/runtasks/pass"
GITHUB_POLICY_SET_IDENTIFIER: "hashicorp/test-policy-set"
GITHUB_REGISTRY_MODULE_IDENTIFIER: "hashicorp/terraform-random-module"
GITHUB_WORKSPACE_IDENTIFIER: "hashicorp/terraform-random-module"
GITHUB_WORKSPACE_BRANCH: "main"
GITHUB_TOKEN: "${{ inputs.testing-github-token }}"
MOD_PROVIDER: github.com/hashicorp/terraform-provider-tfe
MOD_TFE: github.com/hashicorp/terraform-provider-tfe/internal/provider
MOD_VERSION: github.com/hashicorp/terraform-provider-tfe/version
run: |
gotestsum --junitfile summary.xml --format short-verbose -- $MOD_PROVIDER $MOD_TFE $MOD_VERSION -v -timeout=30m -run "${{ steps.test_split.outputs.run }}"
# - name: Upload test artifacts
# uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
# with:
# name: junit-test-summary-${{ matrix.index }}
# path: summary.xml
# retention-days: 1
- name: Upload test artifacts
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: junit-test-summary-${{ matrix.index }}
path: summary.xml
retention-days: 1
19 changes: 6 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,11 @@ concurrency:
cancel-in-progress: true

jobs:
notice:
name: TESTS ARE TEMPORARILY DISABLED- RUN CHANGED RESOURCE TESTS LOCALLY
runs-on: ubuntu-latest
steps:
- name: NO-OP
run: |
echo "Tests are skipped. Please test manually."
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: ./.github/actions/lint-provider-tfe

tests:
Expand All @@ -31,18 +24,18 @@ jobs:
fail-fast: false
matrix:
# If you adjust these parameters, also adjust the jrm input files on the "Merge reports" step below
total: [ 1 ]
index: [ 0 ]
total: [ 5 ]
index: [ 0, 1, 2, 3, 4 ]
steps:
- name: Fetch Outputs
id: tflocal
uses: hashicorp-forge/terraform-cloud-action/outputs@4adbe7eea886138ac10a4c09e63c5c568aaa6672 # main
uses: hashicorp-forge/terraform-cloud-action/outputs@5583d5f554d268ac91b3c37fd0a5e9da2c78c017 # v1.1.0
with:
token: "${{ secrets.TF_WORKFLOW_TFLOCAL_CLOUD_TFC_TOKEN }}"
organization: hashicorp-v2
workspace: tflocal-terraform-provider-tfe

- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- uses: ./.github/actions/test-provider-tfe
with:
Expand Down Expand Up @@ -80,7 +73,7 @@ jobs:
run: npm install -g junit-report-merger

- name: Merge reports
run: jrm ./ci-summary-provider.xml "junit-test-summary-0/*.xml"
run: jrm ./ci-summary-provider.xml "junit-test-summary-0/*.xml" "junit-test-summary-1/*.xml" "junit-test-summary-2/*.xml" "junit-test-summary-3/*.xml" "junit-test-summary-4/*.xml"

- name: Upload test artifacts
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/create-release-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
outputs:
version: ${{ steps.remove-leading-v.outputs.version }}
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- uses: actions-ecosystem/action-get-latest-tag@b7c32daec3395a9616f88548363a42652b22d435 # v1.6.0
id: get-latest-tag
Expand All @@ -33,9 +33,9 @@ jobs:
buildBinary:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Set up Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: go.mod
cache: true
Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:
CHECKPOINT_DISABLE: "1"
timeout-minutes: 120
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- run: git config --global user.email "[email protected]"
- run: git config --global user.name "Brandon Croft"
- name: Get yarn cache directory path
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout main
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- name: Deploy docs
uses: mhausenblas/mkdocs-deploy-gh-pages@d77dd03172e96abbcdb081d8c948224762033653 # 1.26
Expand Down
17 changes: 8 additions & 9 deletions .github/workflows/nightly-tfe-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
timeout-minutes: 20
steps:
- name: Build nightly tflocal instance
uses: hashicorp-forge/terraform-cloud-action/apply@4adbe7eea886138ac10a4c09e63c5c568aaa6672 # main
uses: hashicorp-forge/terraform-cloud-action/apply@5583d5f554d268ac91b3c37fd0a5e9da2c78c017 # v1.1.0
with:
token: ${{ secrets.TF_WORKFLOW_TFLOCAL_CLOUD_TFC_TOKEN }}
organization: "hashicorp-v2"
Expand All @@ -25,18 +25,18 @@ jobs:
strategy:
fail-fast: false
matrix:
total: [ 1 ]
index: [ 0 ]
total: [ 5 ]
index: [ 0, 1, 2, 3, 4 ]
steps:
- name: Fetch Outputs
id: tflocal
uses: hashicorp-forge/terraform-cloud-action/outputs@4adbe7eea886138ac10a4c09e63c5c568aaa6672 # main
uses: hashicorp-forge/terraform-cloud-action/outputs@5583d5f554d268ac91b3c37fd0a5e9da2c78c017 # v1.1.0
with:
token: "${{ secrets.TF_WORKFLOW_TFLOCAL_CLOUD_TFC_TOKEN }}"
organization: hashicorp-v2
workspace: tflocal-terraform-provider-tfe-nightly

- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- uses: ./.github/actions/test-provider-tfe
with:
Expand Down Expand Up @@ -96,20 +96,19 @@ jobs:
needs: [tests-summarize]
if: "${{ always() }}"
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- name: Set up Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: go.mod
check-latest: true
cache: true

- name: Destroy nightly tflocal instance
uses: hashicorp-forge/terraform-cloud-action/destroy@4adbe7eea886138ac10a4c09e63c5c568aaa6672 # main
uses: hashicorp-forge/terraform-cloud-action/destroy@5583d5f554d268ac91b3c37fd0a5e9da2c78c017 # v1.1.0
with:
token: ${{ secrets.TF_WORKFLOW_TFLOCAL_CLOUD_TFC_TOKEN }}
organization: "hashicorp-v2"
workspace: tflocal-terraform-provider-tfe-nightly
wait: true
is-destroy: true
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
release-notes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
fetch-depth: 0
- name: Generate Release Notes
Expand Down
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@

ENHANCEMENTS:
* `r/tfe_oauth_client`: Add Bitbucket Data Center support with the `bitbucket_data_center` option for `service_provider` by @zainq11 [#1303](https://github.com/hashicorp/terraform-provider-tfe/pull/1304)
* `r/tfe_workspace`: Add an `auto_destroy_at` attribute for scheduling an auto-destroy run in the future, by @notchairmk [1354](https://github.com/hashicorp/terraform-provider-tfe/pull/1354)
* `d/tfe_workspace`: Add an `auto_destroy_at` attribute for reading a scheduled auto-destroy, by @notchairmk [1354](https://github.com/hashicorp/terraform-provider-tfe/pull/1354)
* `r/tfe_registry_module`: Add `initial_version` support for Branch Based Modules by @aaabdelgany [#1363](https://github.com/hashicorp/terraform-provider-tfe/pull/1363)
* **New Data Source**: `d/tfe_projects` is a new data source to retrieve all projects in an organization, by @tdevelioglu

## v0.55.0

FEATURES:
* `r/tfe_team`: Add attributes `manage_teams`, `manage_organization_access`, and `access_secret_teams` to `organization_access` on `tfe_team` by @juliannatetreault [#1313](https://github.com/hashicorp/terraform-provider-tfe/pull/1313)

FEATURES:
* **New Data Source**: `d/tfe_projects` is a new data source to retrieve all projects in an organization, by @tdevelioglu
ENHANCEMENTS:
* `r/tfe_project`: Increase the Project name length from 36 to 40 characters @hs26gill [#1351](https://github.com/hashicorp/terraform-provider-tfe/pull/1351)

## v0.54.0

Expand Down
11 changes: 11 additions & 0 deletions internal/provider/data_source_workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ func dataSourceTFEWorkspace() *schema.Resource {
Computed: true,
},

"auto_destroy_at": {
Type: schema.TypeString,
Computed: true,
},

"file_triggers_enabled": {
Type: schema.TypeBool,
Computed: true,
Expand Down Expand Up @@ -240,6 +245,12 @@ func dataSourceTFEWorkspaceRead(d *schema.ResourceData, meta interface{}) error
d.Set("operations", workspace.Operations)
d.Set("policy_check_failures", workspace.PolicyCheckFailures)

autoDestroyAt, err := flattenAutoDestroyAt(workspace.AutoDestroyAt)
if err != nil {
return fmt.Errorf("Error flattening auto destroy during read: %w", err)
}
d.Set("auto_destroy_at", autoDestroyAt)

// If target tfe instance predates projects, then workspace.Project will be nil
if workspace.Project != nil {
d.Set("project_id", workspace.Project.ID)
Expand Down
Loading

0 comments on commit 4b3169b

Please sign in to comment.