-
Notifications
You must be signed in to change notification settings - Fork 986
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for deferred actions (#2510)
* Deferred actions for SDK resources * Deferred actions for kubernetes_manifest * Defer on missing CRD * Deprecate manifest experiment flag in framework * Add example for deferred actions * Deferred actions acc test * Add ProtocolVersion attribute to provider reattach configuration * Extract mux setup into own function to re-use in acc test * Add version constraint for DA test * New GH action to run DA tests
- Loading branch information
1 parent
0687d3d
commit 55edec5
Showing
25 changed files
with
2,559 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:enhancement | ||
Add support for Terraform's experimental deferred actions | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Deferred Actions | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- "manifest/**/*.go" | ||
- 'kubernetes/**/*.go' | ||
- "go.mod" | ||
workflow_dispatch: | ||
inputs: | ||
terraformVersion: | ||
description: Terraform version | ||
default: 1.9.0-alpha20240516 | ||
|
||
jobs: | ||
acceptance_tests: | ||
runs-on: custom-linux-medium | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | ||
- name: Set up Go | ||
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 | ||
with: | ||
go-version-file: 'go.mod' | ||
- name: Run Tests | ||
env: | ||
TF_ACC: 1 | ||
TF_ACC_TERRAFORM_VERSION: ${{ github.event.inputs.terraformVersion || vars.TERRAFORM_VERSION_EXP }} | ||
run: | | ||
go test -v -run '^TestAccKubernetesDeferredActions' ./kubernetes/test-dfa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
terraform { | ||
required_providers { | ||
kind = { | ||
source = "tehcyx/kind" | ||
} | ||
kubernetes = {} | ||
} | ||
} | ||
|
||
resource "kind_cluster" "demo" { | ||
name = "demo-cluster" | ||
} | ||
|
||
provider "kubernetes" { | ||
host = kind_cluster.demo.endpoint | ||
cluster_ca_certificate = kind_cluster.demo.cluster_ca_certificate | ||
client_certificate = kind_cluster.demo.client_certificate | ||
client_key = kind_cluster.demo.client_key | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
resource "kubernetes_namespace_v1" "demo_ns" { | ||
metadata { | ||
name = "demo-ns" | ||
} | ||
} | ||
|
||
resource "kubernetes_manifest" "demo_workspace" { | ||
manifest = { | ||
apiVersion = "app.terraform.io/v1alpha2" | ||
kind = kubernetes_manifest.crd_workspaces.object.spec.names.kind | ||
metadata = { | ||
name = "deferred-demo" | ||
namespace = kubernetes_namespace_v1.demo_ns.id | ||
} | ||
spec = { | ||
name = "demo-ws" | ||
organization = "demo-org" | ||
token = { | ||
secretKeyRef = { | ||
name = "demo-token" | ||
key = "token" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.