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

Add support for deferred actions #2510

Merged
merged 24 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
7bdc91e
Adopt DF dev branches
alexsomesan Apr 23, 2024
6493a44
Override SDK and plugin-go with development branches for deferred act…
alexsomesan Apr 30, 2024
8cf6d3a
Deferred actions for SDK resources
alexsomesan Apr 30, 2024
0094b94
Update terraform-plugin-go, terraform-plugin-mux, SDK and terraform-p…
alexsomesan May 14, 2024
6f07c3a
Deferred actions for kubernetes_manifest
alexsomesan Apr 30, 2024
e5f741c
Deprecate manifest experiment flag in framework
alexsomesan Apr 30, 2024
57f807d
Deferr on missing CRD
alexsomesan May 9, 2024
b160df4
Add example for deferred actions
alexsomesan May 14, 2024
cb6fd79
Deferred actions acc test
alexsomesan May 29, 2024
7ddf8f1
Add ProtocolVersion attribute to provider reattach configuration
alexsomesan Apr 30, 2024
2fc7dcb
Check for nil when evaluating ClientCapabilities
alexsomesan May 8, 2024
f602bc6
Extract mux setup into own function to re-use in acc test
alexsomesan May 31, 2024
1f34e2f
go fmt
alexsomesan May 31, 2024
1a20023
Add version constraint for DA test
alexsomesan May 31, 2024
b4c4cc5
GH action to run DA tests
alexsomesan May 31, 2024
ae84b87
GH action to run DA tests
alexsomesan May 31, 2024
6df4aa5
GH action to run DA tests
alexsomesan May 31, 2024
aaecaf3
GH action to run DA tests
alexsomesan May 31, 2024
77014cc
Changelog entry
alexsomesan May 31, 2024
c9de471
Cleanup Terraform version selection in DA workflow
alexsomesan May 31, 2024
94440ae
Add missing copyright headers
alexsomesan May 31, 2024
341d56f
Add missing copyright headers
alexsomesan May 31, 2024
e280836
Literal default for workflow input
alexsomesan May 31, 2024
f42dfe2
Cleanup Terraform version selection in DA workflow
alexsomesan May 31, 2024
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
3 changes: 3 additions & 0 deletions .changelog/2510.txt
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
```
32 changes: 32 additions & 0 deletions .github/workflows/acceptance_test_dfa.yaml
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
22 changes: 22 additions & 0 deletions _examples/deferred-actions/cluster.tf
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
}
1,032 changes: 1,032 additions & 0 deletions _examples/deferred-actions/crd.tf

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions _examples/deferred-actions/workspace.tf
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"
}
}
}
}
}
42 changes: 21 additions & 21 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@ require (
github.com/Masterminds/semver v1.5.0
github.com/getkin/kin-openapi v0.111.0
github.com/google/go-cmp v0.6.0
github.com/hashicorp/go-hclog v1.6.2
github.com/hashicorp/go-hclog v1.6.3
github.com/hashicorp/go-plugin v1.6.0
github.com/hashicorp/go-version v1.6.0
github.com/hashicorp/hc-install v0.6.3
github.com/hashicorp/hcl/v2 v2.20.0
github.com/hashicorp/terraform-exec v0.20.0
github.com/hashicorp/terraform-json v0.21.0
github.com/hashicorp/hc-install v0.6.4
github.com/hashicorp/hcl/v2 v2.20.1
github.com/hashicorp/terraform-exec v0.21.0
github.com/hashicorp/terraform-json v0.22.1
github.com/hashicorp/terraform-plugin-docs v0.16.0
github.com/hashicorp/terraform-plugin-framework v1.7.0
github.com/hashicorp/terraform-plugin-go v0.22.1
github.com/hashicorp/terraform-plugin-go v0.23.0
github.com/hashicorp/terraform-plugin-log v0.9.0
github.com/hashicorp/terraform-plugin-mux v0.15.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0
github.com/hashicorp/terraform-plugin-testing v1.7.0
github.com/hashicorp/terraform-plugin-mux v0.16.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0
github.com/hashicorp/terraform-plugin-testing v1.8.0
github.com/jinzhu/copier v0.3.5
github.com/mitchellh/go-homedir v1.1.0
github.com/mitchellh/hashstructure v1.1.0
github.com/robfig/cron v1.2.0
github.com/stretchr/testify v1.8.2
golang.org/x/mod v0.15.0
golang.org/x/mod v0.16.0
k8s.io/api v0.28.6
k8s.io/apiextensions-apiserver v0.28.6
k8s.io/apimachinery v0.28.6
Expand All @@ -40,7 +40,7 @@ require (
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.2.0 // indirect
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
github.com/ProtonMail/go-crypto v1.1.0-alpha.0 // indirect
github.com/ProtonMail/go-crypto v1.1.0-alpha.2 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/armon/go-radix v1.0.0 // indirect
github.com/bgentry/speakeasy v0.1.0 // indirect
Expand All @@ -61,7 +61,7 @@ require (
golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/tools v0.16.1 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect
)

require (
Expand All @@ -80,7 +80,7 @@ require (
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
Expand Down Expand Up @@ -123,18 +123,18 @@ require (
github.com/spf13/pflag v1.0.5 // indirect
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
github.com/xlab/treeprint v1.2.0 // indirect
github.com/zclconf/go-cty v1.14.3
github.com/zclconf/go-cty v1.14.4
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/oauth2 v0.16.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/oauth2 v0.17.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/term v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/grpc v1.62.1
google.golang.org/protobuf v1.33.0 // indirect
google.golang.org/grpc v1.63.2
google.golang.org/protobuf v1.34.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading
Loading