├── .ci-mgmt.yaml
├── .github
└── workflows
│ ├── build.yml
│ ├── command-dispatch.yml
│ ├── prerelease.yml
│ ├── pull-request.yml
│ ├── release.yml
│ ├── run-acceptance-tests.yml
│ └── weekly-pulumi-update.yml
├── .gitignore
├── .golangci.yml
├── .goreleaser.prerelease.yml
├── .goreleaser.yml
├── .pulumi.version
├── CHANGELOG_OLD.md
├── CODE-OF-CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── Makefile
├── README.md
├── docs
└── _index.md
├── examples
├── examples_dotnet_test.go
├── examples_go_test.go
├── examples_java_test.go
├── examples_nodejs_test.go
├── examples_python_test.go
├── examples_test.go
├── examples_yaml_test.go
├── local
│ ├── dotnet
│ │ ├── .gitignore
│ │ ├── Program.cs
│ │ ├── Pulumi.yaml
│ │ ├── dotnet.csproj
│ │ └── terraform.0-12-24.tfstate
│ ├── go
│ │ ├── Pulumi.yaml
│ │ ├── go.mod
│ │ ├── go.sum
│ │ ├── main.go
│ │ └── terraform.0-12-24.tfstate
│ ├── java
│ │ ├── Pulumi.yaml
│ │ ├── pom.xml
│ │ ├── src
│ │ │ └── main
│ │ │ │ └── java
│ │ │ │ └── myproject
│ │ │ │ └── App.java
│ │ └── terraform.0-12-24.tfstate
│ ├── nodejs
│ │ ├── .gitignore
│ │ ├── Pulumi.yaml
│ │ ├── index.ts
│ │ ├── package.json
│ │ ├── terraform.0-12-24.tfstate
│ │ └── tsconfig.json
│ ├── python
│ │ ├── .gitignore
│ │ ├── Pulumi.yaml
│ │ ├── __main__.py
│ │ ├── requirements.txt
│ │ └── terraform.0-12-24.tfstate
│ └── yaml
│ │ ├── Pulumi.yaml
│ │ └── terraform.0-12-24.tfstate
└── remote
│ ├── go
│ ├── Pulumi.yaml
│ ├── go.mod
│ ├── go.sum
│ └── main.go
│ └── yaml
│ └── Pulumi.yaml
├── go.mod
├── go.sum
├── main.go
├── provider
├── log.go
├── provider.go
├── shim
│ ├── go.mod
│ ├── go.sum
│ └── shim.go
├── state_reference
│ ├── local.go
│ ├── remote.go
│ └── state_reference.go
└── version
│ └── version.go
├── schema.json
└── sdk
├── .gitignore
├── dotnet
├── Provider.cs
├── Pulumi.Terraform.csproj
├── README.md
├── State
│ ├── GetLocalReference.cs
│ ├── GetRemoteReference.cs
│ ├── Inputs
│ │ ├── Workspaces.cs
│ │ └── WorkspacesArgs.cs
│ └── README.md
├── Utilities.cs
├── logo.png
└── pulumi-plugin.json
├── go.mod
├── go.sum
├── go
└── terraform
│ ├── doc.go
│ ├── init.go
│ ├── internal
│ ├── pulumiUtilities.go
│ └── pulumiVersion.go
│ ├── provider.go
│ ├── pulumi-plugin.json
│ └── state
│ ├── getLocalReference.go
│ ├── getRemoteReference.go
│ └── pulumiTypes.go
├── java
├── README.md
├── settings.gradle
└── src
│ └── main
│ └── java
│ └── com
│ └── pulumi
│ └── terraform
│ ├── Provider.java
│ ├── ProviderArgs.java
│ ├── Utilities.java
│ └── state
│ ├── StateFunctions.java
│ ├── inputs
│ ├── GetLocalReferenceArgs.java
│ ├── GetLocalReferencePlainArgs.java
│ ├── GetRemoteReferenceArgs.java
│ ├── GetRemoteReferencePlainArgs.java
│ ├── Workspaces.java
│ └── WorkspacesArgs.java
│ └── outputs
│ ├── GetLocalReferenceResult.java
│ └── GetRemoteReferenceResult.java
├── nodejs
├── README.md
├── index.ts
├── package.json
├── provider.ts
├── state
│ ├── getLocalReference.ts
│ ├── getRemoteReference.ts
│ └── index.ts
├── tsconfig.json
├── types
│ ├── index.ts
│ ├── input.ts
│ └── output.ts
└── utilities.ts
└── python
├── README.md
├── pulumi_terraform
├── README.md
├── __init__.py
├── _utilities.py
├── provider.py
├── pulumi-plugin.json
├── py.typed
└── state
│ ├── __init__.py
│ ├── _inputs.py
│ ├── get_local_reference.py
│ └── get_remote_reference.py
└── pyproject.toml
/.ci-mgmt.yaml:
--------------------------------------------------------------------------------
1 | template: native
2 | provider: terraform
3 | major-version: 6
4 | pulumiVersionFile: .pulumi.version
5 | providerDefaultBranch: master
6 | parallel: 3
7 | envOverride:
8 | PULUMI_API: https://api.pulumi-staging.io
9 | TFE_ORGANIZATION: ${{ secrets.TFE_ORGANIZATION }}
10 | TFE_TOKEN: ${{ secrets.TFE_TOKEN }}
11 |
--------------------------------------------------------------------------------
/.github/workflows/command-dispatch.yml:
--------------------------------------------------------------------------------
1 | # WARNING: This file is autogenerated - changes will be overwritten if not made via https://github.com/pulumi/ci-mgmt
2 |
3 | name: command-dispatch
4 | on:
5 | issue_comment:
6 | types:
7 | - created
8 | - edited
9 | env:
10 | GITHUB_TOKEN: ${{ secrets.PULUMI_BOT_TOKEN }}
11 | PROVIDER: terraform
12 | PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
13 | PULUMI_LOCAL_NUGET: ${{ github.workspace }}/nuget
14 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
15 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
16 | NUGET_PUBLISH_KEY: ${{ secrets.NUGET_PUBLISH_KEY }}
17 | PYPI_USERNAME: __token__
18 | PYPI_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
19 | TRAVIS_OS_NAME: linux
20 | SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
21 | PULUMI_GO_DEP_ROOT: ${{ github.workspace }}/..
22 | PUBLISH_REPO_USERNAME: ${{ secrets.OSSRH_USERNAME }}
23 | PUBLISH_REPO_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
24 | SIGNING_KEY_ID: ${{ secrets.JAVA_SIGNING_KEY_ID }}
25 | SIGNING_KEY: ${{ secrets.JAVA_SIGNING_KEY }}
26 | SIGNING_PASSWORD: ${{ secrets.JAVA_SIGNING_PASSWORD }}
27 | GOVERSION: "1.21.x"
28 | NODEVERSION: "20.x"
29 | PYTHONVERSION: "3.11.8"
30 | DOTNETVERSION: "8.0.x"
31 | JAVAVERSION: "11"
32 | PULUMI_API: https://api.pulumi-staging.io
33 | TFE_ORGANIZATION: ${{ secrets.TFE_ORGANIZATION }}
34 | TFE_TOKEN: ${{ secrets.TFE_TOKEN }}
35 | jobs:
36 | command-dispatch-for-testing:
37 | runs-on: ubuntu-latest
38 | name: command-dispatch-for-testing
39 | steps:
40 | - name: Checkout Repo
41 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
42 | with:
43 | lfs: true
44 | - uses: peter-evans/slash-command-dispatch@13bc09769d122a64f75aa5037256f6f2d78be8c4 # v4.0.0
45 | with:
46 | token: ${{ secrets.PULUMI_BOT_TOKEN }}
47 | reaction-token: ${{ secrets.GITHUB_TOKEN }}
48 | commands: run-acceptance-tests
49 | permission: write
50 | issue-type: pull-request
51 | repository: pulumi/pulumi-terraform
52 | if: ${{ github.event.issue.pull_request }}
53 |
--------------------------------------------------------------------------------
/.github/workflows/pull-request.yml:
--------------------------------------------------------------------------------
1 | # WARNING: This file is autogenerated - changes will be overwritten if not made via https://github.com/pulumi/ci-mgmt
2 |
3 | name: pull-request
4 | on:
5 | pull_request_target: {}
6 | env:
7 | GITHUB_TOKEN: ${{ secrets.PULUMI_BOT_TOKEN }}
8 | PROVIDER: terraform
9 | PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
10 | PULUMI_LOCAL_NUGET: ${{ github.workspace }}/nuget
11 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
12 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
13 | NUGET_PUBLISH_KEY: ${{ secrets.NUGET_PUBLISH_KEY }}
14 | PYPI_USERNAME: __token__
15 | PYPI_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
16 | TRAVIS_OS_NAME: linux
17 | SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
18 | PULUMI_GO_DEP_ROOT: ${{ github.workspace }}/..
19 | PUBLISH_REPO_USERNAME: ${{ secrets.OSSRH_USERNAME }}
20 | PUBLISH_REPO_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
21 | SIGNING_KEY_ID: ${{ secrets.JAVA_SIGNING_KEY_ID }}
22 | SIGNING_KEY: ${{ secrets.JAVA_SIGNING_KEY }}
23 | SIGNING_PASSWORD: ${{ secrets.JAVA_SIGNING_PASSWORD }}
24 | GOVERSION: "1.21.x"
25 | NODEVERSION: "20.x"
26 | PYTHONVERSION: "3.11.8"
27 | DOTNETVERSION: "8.0.x"
28 | JAVAVERSION: "11"
29 | PULUMI_API: https://api.pulumi-staging.io
30 | TFE_ORGANIZATION: ${{ secrets.TFE_ORGANIZATION }}
31 | TFE_TOKEN: ${{ secrets.TFE_TOKEN }}
32 | jobs:
33 | comment-on-pr:
34 | runs-on: ubuntu-latest
35 | name: comment-on-pr
36 | steps:
37 | - name: Checkout Repo
38 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
39 | with:
40 | lfs: true
41 | - name: Comment PR
42 | uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1
43 | with:
44 | message: >
45 | PR is now waiting for a maintainer to run the acceptance tests.
46 |
47 | **Note for the maintainer:** To run the acceptance tests, please comment */run-acceptance-tests* on the PR
48 | github-token: ${{ secrets.GITHUB_TOKEN }}
49 | if: github.event.pull_request.head.repo.full_name != github.repository
50 |
--------------------------------------------------------------------------------
/.github/workflows/weekly-pulumi-update.yml:
--------------------------------------------------------------------------------
1 | # WARNING: This file is autogenerated - changes will be overwritten if not made via https://github.com/pulumi/ci-mgmt
2 |
3 | name: weekly-pulumi-update
4 | on:
5 | schedule:
6 | - cron: 35 12 * * 4
7 | workflow_dispatch: {}
8 | env:
9 | GITHUB_TOKEN: ${{ secrets.PULUMI_BOT_TOKEN }}
10 | PROVIDER: terraform
11 | PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
12 | PULUMI_LOCAL_NUGET: ${{ github.workspace }}/nuget
13 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
14 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
15 | NUGET_PUBLISH_KEY: ${{ secrets.NUGET_PUBLISH_KEY }}
16 | PYPI_USERNAME: __token__
17 | PYPI_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
18 | TRAVIS_OS_NAME: linux
19 | SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
20 | PULUMI_GO_DEP_ROOT: ${{ github.workspace }}/..
21 | PUBLISH_REPO_USERNAME: ${{ secrets.OSSRH_USERNAME }}
22 | PUBLISH_REPO_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
23 | SIGNING_KEY_ID: ${{ secrets.JAVA_SIGNING_KEY_ID }}
24 | SIGNING_KEY: ${{ secrets.JAVA_SIGNING_KEY }}
25 | SIGNING_PASSWORD: ${{ secrets.JAVA_SIGNING_PASSWORD }}
26 | GOVERSION: "1.21.x"
27 | NODEVERSION: "20.x"
28 | PYTHONVERSION: "3.11.8"
29 | DOTNETVERSION: "8.0.x"
30 | JAVAVERSION: "11"
31 | PULUMI_API: https://api.pulumi-staging.io
32 | TFE_ORGANIZATION: ${{ secrets.TFE_ORGANIZATION }}
33 | TFE_TOKEN: ${{ secrets.TFE_TOKEN }}
34 | jobs:
35 | weekly-pulumi-update:
36 | runs-on: ubuntu-latest
37 | steps:
38 | - name: Checkout Repo
39 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
40 | with:
41 | lfs: true
42 | - name: Install Go
43 | uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
44 | with:
45 | go-version: ${{ env.GOVERSION }}
46 | cache-dependency-path: "**/*.sum"
47 | - name: Install pulumictl
48 | uses: jaxxstorm/action-install-gh-release@6096f2a2bbfee498ced520b6922ac2c06e990ed2 # v2.1.0
49 | with:
50 | repo: pulumi/pulumictl
51 | - name: Install Pulumi CLI
52 | uses: pulumi/actions@df5a93ad715135263c732ba288301bd044c383c0 # v6.3.0
53 | with:
54 | pulumi-version-file: .pulumi.version
55 | - name: Setup DotNet
56 | uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
57 | with:
58 | dotnet-version: ${{ env.DOTNETVERSION }}
59 | - name: Setup Node
60 | uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
61 | with:
62 | node-version: ${{ env.NODEVERSION }}
63 | registry-url: https://registry.npmjs.org
64 | - name: Setup Python
65 | uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
66 | with:
67 | python-version: ${{ env.PYTHONVERSION }}
68 | - name: Update Pulumi/Pulumi
69 | id: gomod
70 | run: >-
71 | git config --local user.email 'bot@pulumi.com'
72 |
73 | git config --local user.name 'pulumi-bot'
74 |
75 | git checkout -b update-pulumi/${{ github.run_id }}-${{ github.run_number }}
76 |
77 | for MODFILE in $(find . -name go.mod); do pushd $(dirname $MODFILE); go get github.com/pulumi/pulumi/pkg/v3 github.com/pulumi/pulumi/sdk/v3; go mod tidy; popd; done
78 |
79 | gh repo view pulumi/pulumi --json latestRelease --jq .latestRelease.tagName | sed 's/^v//' > .pulumi.version
80 |
81 | git update-index -q --refresh
82 |
83 | if ! git diff-files --quiet; then echo changes=1 >> "$GITHUB_OUTPUT"; fi
84 | - name: Provider with Pulumi Upgrade
85 | if: steps.gomod.outputs.changes != 0
86 | run: >-
87 | make codegen && make local_generate
88 |
89 | git add sdk/nodejs
90 |
91 | git commit -m "Regenerating Node.js SDK based on updated modules" || echo "ignore commit failure, may be empty"
92 |
93 | git add sdk/python
94 |
95 | git commit -m "Regenerating Python SDK based on updated modules" || echo "ignore commit failure, may be empty"
96 |
97 | git add sdk/dotnet
98 |
99 | git commit -m "Regenerating .NET SDK based on updated modules" || echo "ignore commit failure, may be empty"
100 |
101 | git add sdk/go*
102 |
103 | git commit -m "Regenerating Go SDK based on updated modules" || echo "ignore commit failure, may be empty"
104 |
105 | git add sdk/java*
106 |
107 | git commit -m "Regenerating Java SDK based on updated modules" || echo "ignore commit failure, may be empty"
108 |
109 | git add .
110 |
111 | git commit -m "Updated modules" || echo "ignore commit failure, may be empty"
112 |
113 | git push origin update-pulumi/${{ github.run_id }}-${{ github.run_number }}
114 | - name: Create PR
115 | id: create-pr
116 | if: steps.gomod.outputs.changes != 0
117 | run: >
118 | ver=$(cat .pulumi.version)
119 |
120 | msg="Automated upgrade: bump pulumi/pulumi to ${ver}"
121 |
122 | # See https://github.com/cli/cli/issues/6485#issuecomment-2560935183 for --head workaround
123 |
124 | gh pr create -t "$msg" -b "$msg" --head $(git branch --show-current)
125 | env:
126 | GITHUB_TOKEN: ${{ secrets.PULUMI_BOT_TOKEN }}
127 | name: weekly-pulumi-update
128 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | .code
3 | **/vendor/
4 | .pulumi
5 | **/bin/
6 | **/obj/
7 | Pulumi.*.yaml
8 | **/node_modules/
9 | .DS_Store
10 |
11 | **/command-output/
12 |
13 | .idea/
14 | *.iml
15 |
16 | yarn.lock
17 | **/pulumiManifest.go
18 |
19 | ci-scripts
20 | **/schema.go
21 | **/version.txt
22 | **/nuget
23 | **/maven
24 | **/dist
25 | .make
26 | sdk/java/build
27 | sdk/java/.gradle
28 | sdk/java/build.gradle
29 | sdk/python/venv
30 |
--------------------------------------------------------------------------------
/.golangci.yml:
--------------------------------------------------------------------------------
1 | run:
2 | timeout: 10m
3 | # Enable checking the by default skipped "examples" dirs
4 | build-tags:
5 | - all
6 | linters:
7 | enable-all: false
8 | enable:
9 | - durationcheck
10 | - errcheck
11 | - exhaustive
12 | - gofumpt
13 | - goheader
14 | - goprintffuncname
15 | - gosec
16 | - govet
17 | - importas
18 | - ineffassign
19 | - lll
20 | - misspell
21 | - nakedret
22 | - nolintlint
23 | - paralleltest
24 | - perfsprint
25 | - prealloc
26 | - revive
27 | - unconvert
28 | - unused
29 | - usetesting
30 | - wastedassign
31 | - whitespace
32 |
33 | linters-settings:
34 | nakedret:
35 | # Make an issue if func has more lines of code than this setting, and it has naked returns.
36 | # Default: 30
37 | max-func-lines: 60
38 | govet:
39 | enable:
40 | - nilness
41 | # Reject comparisons of reflect.Value with DeepEqual or '=='.
42 | - reflectvaluecompare
43 | # Reject sort.Slice calls with a non-slice argument.
44 | - sortslice
45 | # Detect write to struct/arrays by-value that aren't read again.
46 | - unusedwrite
47 | goheader:
48 | values:
49 | regexp:
50 | COPYRIGHT_YEARS: (\d{4}-)?\d{4}
51 | WHITESPACE: \s*
52 | template: |-
53 | Copyright {{ COPYRIGHT_YEARS }}, Pulumi Corporation.
54 |
55 | Licensed under the Apache License, Version 2.0 (the "License");
56 | you may not use this file except in compliance with the License.
57 | You may obtain a copy of the License at
58 |
59 | {{ WHITESPACE }}http://www.apache.org/licenses/LICENSE-2.0
60 |
61 | Unless required by applicable law or agreed to in writing, software
62 | distributed under the License is distributed on an "AS IS" BASIS,
63 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
64 | See the License for the specific language governing permissions and
65 | limitations under the License.
66 |
67 | issues:
68 | exclude-rules:
69 | # staticcheck already has smarter checks for empty blocks.
70 | # revive's empty-block linter has false positives.
71 | # For example, as of writing this, the following is not allowed.
72 | # for foo() { }
73 | - linters: [revive]
74 | text: 'empty-block: this block is empty, you can remove it'
75 |
76 | exclude-dirs:
77 | - sdk
78 | exclude-dirs-use-default: false
79 |
--------------------------------------------------------------------------------
/.goreleaser.prerelease.yml:
--------------------------------------------------------------------------------
1 | # WARNING: This file is autogenerated - changes will be overwritten if not made via https://github.com/pulumi/ci-mgmt
2 |
3 | project_name: pulumi-terraform
4 | builds:
5 | - id: build-provider
6 | env:
7 | - CGO_ENABLED=0
8 | - GO111MODULE=on
9 | goos:
10 | - darwin
11 | - linux
12 | goarch:
13 | - amd64
14 | - arm64
15 | ignore: &a1 []
16 | ldflags: &a2
17 | - -s
18 | - -w
19 | - -X
20 | github.com/pulumi/pulumi-terraform/v6/provider/version.version={{.Tag}}
21 | binary: pulumi-resource-terraform
22 | - id: build-provider-sign-windows
23 | env:
24 | - CGO_ENABLED=0
25 | - GO111MODULE=on
26 | goos:
27 | - windows
28 | goarch:
29 | - amd64
30 | - arm64
31 | ignore: *a1
32 | ldflags: *a2
33 | binary: pulumi-resource-terraform
34 | hooks:
35 | post:
36 | - make sign-goreleaser-exe-{{ .Arch }}
37 | archives:
38 | - name_template: "{{ .Binary }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}"
39 | id: archive
40 | snapshot:
41 | name_template: "{{ .Tag }}-SNAPSHOT"
42 | changelog:
43 | skip: true
44 | release:
45 | disable: true
46 | blobs:
47 | - provider: s3
48 | region: us-west-2
49 | bucket: get.pulumi.com
50 | folder: releases/plugins/
51 | ids:
52 | - archive
53 |
--------------------------------------------------------------------------------
/.goreleaser.yml:
--------------------------------------------------------------------------------
1 | # WARNING: This file is autogenerated - changes will be overwritten if not made via https://github.com/pulumi/ci-mgmt
2 |
3 | project_name: pulumi-terraform
4 | builds:
5 | - id: build-provider
6 | env:
7 | - CGO_ENABLED=0
8 | - GO111MODULE=on
9 | goos:
10 | - darwin
11 | - linux
12 | goarch:
13 | - amd64
14 | - arm64
15 | ignore: &a1 []
16 | ldflags: &a2
17 | - -s
18 | - -w
19 | - -X
20 | github.com/pulumi/pulumi-terraform/v6/provider/version.version={{.Tag}}
21 | binary: pulumi-resource-terraform
22 | - id: build-provider-sign-windows
23 | env:
24 | - CGO_ENABLED=0
25 | - GO111MODULE=on
26 | goos:
27 | - windows
28 | goarch:
29 | - amd64
30 | - arm64
31 | ignore: *a1
32 | ldflags: *a2
33 | binary: pulumi-resource-terraform
34 | hooks:
35 | post:
36 | - make sign-goreleaser-exe-{{ .Arch }}
37 | archives:
38 | - name_template: "{{ .Binary }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}"
39 | id: archive
40 | snapshot:
41 | name_template: "{{ .Tag }}-SNAPSHOT"
42 | changelog:
43 | skip: true
44 | release:
45 | disable: false
46 | blobs:
47 | - provider: s3
48 | region: us-west-2
49 | bucket: get.pulumi.com
50 | folder: releases/plugins/
51 | ids:
52 | - archive
53 |
--------------------------------------------------------------------------------
/.pulumi.version:
--------------------------------------------------------------------------------
1 | v3.160.0
--------------------------------------------------------------------------------
/CHANGELOG_OLD.md:
--------------------------------------------------------------------------------
1 | CHANGELOG
2 | =========
3 |
4 | ## Notice (2022-01-06)
5 |
6 | *As of this notice, using CHANGELOG.md is DEPRECATED. We will be using [GitHub Releases](https://github.com/pulumi/pulumi-terraform/releases) for this repository*
7 |
8 | ## HEAD (Unreleased)
9 | _(none)_
10 |
11 | ---
12 |
13 | ## 5.5.1 (2021-12-20)
14 | * Upgrade to Terraform v1.1.2
15 |
16 | ## 5.5.0 (2021-12-10)
17 | * Upgrade to Terraform v1.1.0
18 |
19 | ## 5.4.3 (2021-11-18)
20 | * Upgrade to Terraform v1.0.11
21 |
22 | ## 5.4.2 (2021-11-01)
23 | * Upgrade to Terraform v1.0.10
24 |
25 | ## 5.4.1 (2021-10-04)
26 | * Upgrade to Terraform v1.0.8
27 |
28 | ## 5.4.0 (2021-09-27)
29 | * Upgrade to Terraform v1.0.7
30 |
31 | ## 5.3.0 (2021-09-09)
32 | * Upgrade to Terraform v1.0.6
33 |
34 | ## 5.2.1 (2021-08-17)
35 | * Add support for S3-style supported backends to the S3 Backend
36 |
37 | ## 5.2.0 (2021-05-12)
38 | * Upgrade to Terraform v0.15.3
39 |
40 | ## 5.1.0 (2021-04-30)
41 | * Upgrade to Terraform v0.15.1
42 |
43 | ## 5.0.0 (2021-04-26)
44 | * Upgrade to Terraform v0.15.0
45 | * Upgrade to Pulumi v3.0
46 | **Please Note:** This upgrade to Pulumi v3 means that we have introduced a major version bump in the provider
47 |
48 | ## 4.7.0 (2021-04-12)
49 | * Upgrade to Terraform v0.14.10
50 |
51 | ## 4.6.0 (2021-03-30)
52 | * Upgrade to Terraform v0.14.9
53 |
54 | ## 4.5.0 (2021-02-25)
55 | * Upgrade to Terraform v0.14.7
56 | * Add support for AliCloud OSS Backend type
57 |
58 | ## 4.4.0 (2021-02-08)
59 | * Upgrade to Terraform v0.14.6
60 |
61 | ## 4.3.0 (2021-01-21)
62 | * Upgrade to Terraform v0.14.5
63 |
64 | ## 4.2.0 (2021-01-08)
65 | * Upgrade to Terraform v0.14.4
66 |
67 | ## 4.1.0 (2020-12-22)
68 | * Upgrade to Terraform v0.14.3
69 |
70 | ## 4.0.0 (2020-12-07)
71 | * Upgrade to Terraform v0.14.0
72 |
73 | ## 3.4.0 (2020-10-26)
74 | * Upgrade to Pulumi v2.12.0
75 | * Upgrade to Terraform v0.13.5
76 |
77 | ## 3.3.0 (2020-10-01)
78 | * Upgrade to Terraform v0.13.4
79 |
80 | ## 3.2.0 (2020-09-19)
81 | * Upgrade to Terraform v0.13.2
82 | * Upgrade to Pulumi v2.10.1
83 |
84 | ## 3.1.0 (2020-09-02)
85 | * Upgrade to Terraform v0.13.2
86 |
87 | ## 3.0.0 (2020-08-28)
88 | * Upgrade to Terraform v0.13.1
89 | * Upgrade to Pulumi v2.9.1
90 |
91 | ## 2.5.0 (2020-08-10)
92 | * Upgrade to Terraform v0.12.29
93 |
94 | ## 2.4.0 (2020-06-26)
95 | * Upgrade to Terraform v0.12.28
96 |
97 | ## 2.3.0 (2020-05-27)
98 | * Upgrade to Terraform v0.12.26
99 |
100 | ## 2.2.0 (2020-05-19)
101 | * Upgrade to Terraform v0.12.25
102 |
103 | ## 2.1.0 (2020-05-15)
104 | * Add support for Go with the `pulumi-terraform` Go SDK
105 |
106 | ## v2.0.0 (2020-05-02)
107 | * `RemoteStateReference` resources can now read states created with Terraform v0.12.24 and below
108 | * Fix a bug with `RemoteStateReference`'s remote state backend on Python, where the workspace name was not getting configured correctly (issue [#524](https://github.com/pulumi/pulumi-terraform/issues/524)).
109 | * Added support for .NET with the `Pulumi.Terraform` NuGet package
110 |
111 | ## v1.1.0 (2019-10-04)
112 | * Upgrade the Pulumi dependency requirements for NodeJS and Python SDKs
113 |
114 | ## v1.0.0 (2019-10-02)
115 | * Use of the `RemoteStateReference` resource no longer results in a panic if the configured remote state cannot be accessed
116 | * `RemoteStateReference` resources can now read states created with Terraform v0.12.9 and below
117 | * Added support for Python with the `pulumi_terraform` package
118 |
119 | ## v0.18.1 (2019-05-16)
120 | * Initial release of `@pulumi/terraform` with support for Node.js.
121 |
--------------------------------------------------------------------------------
/CODE-OF-CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as
6 | contributors and maintainers pledge to making participation in our project and
7 | our community a harassment-free experience for everyone, regardless of age, body
8 | size, disability, ethnicity, gender identity and expression, level of experience,
9 | education, socio-economic status, nationality, personal appearance, race,
10 | religion, or sexual identity and orientation.
11 |
12 | ## Our Standards
13 |
14 | Examples of behavior that contributes to creating a positive environment
15 | include:
16 |
17 | * Using welcoming and inclusive language
18 | * Being respectful of differing viewpoints and experiences
19 | * Gracefully accepting constructive criticism
20 | * Focusing on what is best for the community
21 | * Showing empathy towards other community members
22 | * Contribute in a positive and constructive way
23 |
24 | Examples of unacceptable behavior by participants include:
25 |
26 | * The use of sexualized language or imagery and unwelcome sexual attention or
27 | advances
28 | * Trolling, insulting/derogatory comments, and personal or political attacks
29 | * Public or private harassment
30 | * Publishing others' private information, such as a physical or electronic
31 | address, without explicit permission
32 | * Other conduct which could reasonably be considered inappropriate in a
33 | professional setting
34 |
35 | ## Our Community Guidelines
36 | * Be clear and stay on topic. Communicating with strangers on the Internet can make it hard to convey or read tone, and sarcasm is frequently misunderstood. Try to use clear language, and think about how the other person will receive it.
37 | * Don’t cross-post the same thing in multiple GitHub Discussion topics or multiple Slack channels. This can make it difficult for people answering your questions and creates "scrollback spam".
38 | * Public discussion is preferred to private. Avoid using Slack DMs for questions, and instead share them in public Slack channels or GitHub Discussion threads. This allows a larger audience to both share their knowledge as well as learn from your question or issue. If you're having a problem, chances are someone else is having a similar problem. Learning in public is a community contribution.
39 | * Minimize notifications to other community members. Avoid tagging other community members in Slack messages or Discussion threads, unless you are replying to something specific. Community members are here to help each other, but are not "on call" for support, and we expect everyone to try to minimize "notification fatigue". If your issue is time-sensitive or critical, use methods like support@pulumi.com instead.
40 |
41 | ## Our Responsibilities
42 |
43 | Project maintainers are responsible for clarifying the standards of acceptable
44 | behavior and are expected to take appropriate and fair corrective action in
45 | response to any instances of unacceptable behavior.
46 |
47 | Project maintainers have the right and responsibility to remove, edit, or
48 | reject comments, commits, code, wiki edits, issues, GitHub Discussions posts,
49 | and other contributions that are not aligned to this Code of Conduct, or to ban
50 | temporarily or permanently any contributor for other behaviors that they deem
51 | inappropriate, threatening, offensive, or harmful.
52 |
53 | ## Scope
54 |
55 | This Code of Conduct applies both within project spaces (including the Community Slack
56 | and GitHub Discussions forums) and in public spaces when an individual is representing the
57 | project or its community. Examples of representing a project or community include
58 | using an official project e-mail address, posting via an official social media account,
59 | or acting as an appointed representative at an online or offline event. Representation
60 | of a project may be further defined and clarified by project maintainers.
61 |
62 | ## Enforcement
63 |
64 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
65 | reported by contacting the project team at code-of-conduct@pulumi.com. All
66 | complaints will be reviewed and investigated and will result in a response that
67 | is deemed necessary and appropriate to the circumstances. The project team is
68 | obligated to maintain confidentiality with regard to the reporter of an incident.
69 | Further details of specific enforcement policies may be posted separately.
70 |
71 | Project maintainers who do not follow or enforce the Code of Conduct in good
72 | faith may face temporary or permanent repercussions as determined by other
73 | members of the project's leadership.
74 |
75 | ## Attribution
76 |
77 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
78 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
79 |
80 | [homepage]: https://www.contributor-covenant.org
81 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing to Pulumi
2 |
3 | Do you want to hack on Pulumi? Awesome! We are so happy to have you.
4 |
5 | Please refer to the [Pulumi documentation repo][docsrepo]'s [CONTRIBUTING.md file][contributing] for details on how to do so.
6 |
7 |
8 | [docsrepo]: https://github.com/pulumi/docs/
9 | [contributing]: https://github.com/pulumi/docs/blob/master/CONTRIBUTING.md
10 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Pulumi Terraform Provider
2 |
3 | The Terraform resource provider for Pulumi lets you consume the outputs contained in
4 | Terraform state files from your Pulumi programs.
5 |
6 | > [!IMPORTANT]
7 | > For reference docs and installation instructions, please go to
8 | > .
9 |
--------------------------------------------------------------------------------
/docs/_index.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Terraform
3 | meta_desc: Consume Terraform state in Pulumi
4 | layout: package
5 | ---
6 |
7 | The Terraform provider allows you to reference Terraform state from Pulumi programs.
8 |
9 |
10 | ## Example
11 |
12 | {{< chooser language "typescript,python,go,csharp,java,yaml" >}}
13 |
14 | {{% choosable language typescript %}}
15 |
16 | ```typescript
17 | import { state as tf_state } from "@pulumi/terraform";
18 |
19 | let outputs = tf_state.getLocalReferenceOutput({
20 | path: "./terraform.0-12-24.tfstate",
21 | });
22 |
23 | export const state = outputs.outputs;
24 | ```
25 |
26 | {{% /choosable %}}
27 |
28 | {{% choosable language python %}}
29 |
30 | ```python
31 | import pulumi
32 | import pulumi_terraform as terraform
33 |
34 | outputs = terraform.state.get_local_reference(path="./terraform.0-12-24.tfstate")
35 |
36 | pulumi.export("state", outputs.outputs)
37 | ```
38 |
39 | {{% /choosable %}}
40 |
41 | {{% choosable language go %}}
42 |
43 | ```go
44 | package main
45 |
46 | import (
47 | "github.com/pulumi/pulumi-terraform/sdk/v6/go/terraform/state"
48 | "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
49 | )
50 |
51 | func main() {
52 | pulumi.Run(func(ctx *pulumi.Context) error {
53 | state := state.GetLocalReferenceOutput(ctx, state.GetLocalReferenceOutputArgs{
54 | Path: pulumi.String("./terraform.0-12-24.tfstate"),
55 | })
56 | ctx.Export("state", state.Outputs())
57 | return nil
58 | })
59 | }
60 | ```
61 |
62 | {{% /choosable %}}
63 |
64 | {{% choosable language csharp %}}
65 |
66 | ```csharp
67 | using System.Collections.Generic;
68 | using Pulumi;
69 | using Pulumi.Terraform.State;
70 |
71 | return await Deployment.RunAsync(() =>
72 | {
73 | var outputs = GetLocalReference.Invoke(new GetLocalReferenceInvokeArgs
74 | {
75 | Path = "./terraform.0-12-24.tfstate",
76 | });
77 |
78 | return new Dictionary
79 | {
80 | ["state"] = outputs.Apply(x => x.Outputs),
81 | };
82 | });
83 | ```
84 |
85 | {{% /choosable %}}
86 |
87 | {{% choosable language java %}}
88 |
89 | ```java
90 | package myproject;
91 |
92 | import com.pulumi.Pulumi;
93 | import com.pulumi.core.Output;
94 | import com.pulumi.terraform.state.StateFunctions;
95 | import com.pulumi.terraform.state.inputs.GetLocalReferenceArgs;
96 |
97 | public class App {
98 | public static void main(String[] args) {
99 | Pulumi.run(ctx -> {
100 | var output = StateFunctions.getLocalReference(GetLocalReferenceArgs.builder().path("./terraform.0-12-24.tfstate").build());
101 | ctx.export("state", output.applyValue(x -> x.outputs()));
102 | });
103 | }
104 | }
105 | ```
106 |
107 | {{% /choosable %}}
108 |
109 | {{% choosable language yaml %}}
110 |
111 | ```yaml
112 | name: terraform-local-state-with-yaml
113 | runtime: yaml
114 | outputs:
115 | state:
116 | fn::invoke:
117 | function: terraform:state:getLocalReference
118 | arguments:
119 | path: ./terraform.0-12-24.tfstate
120 | return: outputs
121 | ```
122 |
123 | {{% /choosable %}}
124 |
125 | {{< /chooser >}}
126 |
--------------------------------------------------------------------------------
/examples/examples_dotnet_test.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016-2025, Pulumi Corporation. All rights reserved.
2 | //go:build dotnet || all
3 | // +build dotnet all
4 |
5 | package examples
6 |
7 | import (
8 | "testing"
9 | )
10 |
11 | func TestDotnet(t *testing.T) {
12 | t.Parallel()
13 | LanguageTests(t, "dotnet")
14 | }
15 |
--------------------------------------------------------------------------------
/examples/examples_go_test.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016-2025, Pulumi Corporation. All rights reserved.
2 | //go:build go || all
3 | // +build go all
4 |
5 | package examples
6 |
7 | import (
8 | "testing"
9 | )
10 |
11 | func TestGo(t *testing.T) {
12 | t.Parallel()
13 | LanguageTests(t, "go")
14 | }
15 |
--------------------------------------------------------------------------------
/examples/examples_java_test.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016-2025, Pulumi Corporation. All rights reserved.
2 | //go:build java || all
3 | // +build java all
4 |
5 | package examples
6 |
7 | import (
8 | "testing"
9 | )
10 |
11 | func TestJava(t *testing.T) {
12 | t.Parallel()
13 | LanguageTests(t, "java")
14 | }
15 |
--------------------------------------------------------------------------------
/examples/examples_nodejs_test.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016-2025, Pulumi Corporation. All rights reserved.
2 | //go:build nodejs || all
3 | // +build nodejs all
4 |
5 | package examples
6 |
7 | import (
8 | "testing"
9 | )
10 |
11 | func TestNodejs(t *testing.T) {
12 | t.Parallel()
13 | LanguageTests(t, "nodejs")
14 | }
15 |
--------------------------------------------------------------------------------
/examples/examples_python_test.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016-2025, Pulumi Corporation. All rights reserved.
2 | //go:build python || all
3 | // +build python all
4 |
5 | package examples
6 |
7 | import (
8 | "testing"
9 | )
10 |
11 | func TestPython(t *testing.T) {
12 | t.Parallel()
13 | LanguageTests(t, "python")
14 | }
15 |
--------------------------------------------------------------------------------
/examples/examples_test.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016-2025, Pulumi Corporation.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package examples
16 |
17 | import (
18 | "errors"
19 | "os"
20 | "path/filepath"
21 | "testing"
22 |
23 | "github.com/pulumi/pulumi/pkg/v3/testing/integration"
24 | "github.com/stretchr/testify/assert"
25 | "github.com/stretchr/testify/require"
26 | )
27 |
28 | func getRemoteBackendOrganization(t *testing.T) string {
29 | org, found := os.LookupEnv("TFE_ORGANIZATION")
30 | if !found {
31 | t.Skipf("Skipping... cannot find TFE_ORGANIZATION")
32 | }
33 |
34 | return org
35 | }
36 |
37 | func getRemoteBackendToken(t *testing.T) string {
38 | token, found := os.LookupEnv("TFE_TOKEN")
39 | if !found {
40 | t.Skipf("Skipping... cannot find TFE_TOKEN")
41 | }
42 |
43 | return token
44 | }
45 |
46 | func getwd(t *testing.T) string {
47 | s, err := os.Getwd()
48 | require.NoError(t, err)
49 | return s
50 | }
51 |
52 | func getDependencies(t *testing.T, language string) []string {
53 | switch language {
54 | case "go":
55 | return []string{"github.com/pulumi/pulumi-terraform/sdk/v6=" + getwd(t) + "/../sdk"}
56 | case "nodejs":
57 | return []string{"@pulumi/terraform"}
58 | case "python":
59 | return []string{"../sdk/python"}
60 | case "dotnet":
61 | return []string{"Pulumi.Terraform"}
62 | default:
63 | return nil
64 | }
65 | }
66 |
67 | func TestMain(m *testing.M) {
68 | set := func(envVar, path string) error {
69 | abs, err := filepath.Abs(path)
70 | if err != nil {
71 | return err
72 | }
73 | return os.Setenv(envVar, abs)
74 | }
75 |
76 | err := errors.Join(
77 | set("PULUMI_LOCAL_NUGET", "../nuget"),
78 | set("PULUMI_LOCAL_MAVEN", "../maven"),
79 | )
80 | if err != nil {
81 | panic(err)
82 | }
83 | os.Exit(m.Run())
84 | }
85 |
86 | func LanguageTests(t *testing.T, language string) {
87 | type languageTest struct {
88 | doesNotNeedConfig bool
89 | expectedStackOutputs map[string]any
90 | }
91 | tests := map[string]languageTest{
92 | "local": {
93 | doesNotNeedConfig: true,
94 | expectedStackOutputs: map[string]any{
95 | "state": map[string]any{
96 | "bucket_arn": "arn:aws:s3:::hello-world-abc12345",
97 | "public_subnet_ids": []any{
98 | "subnet-023a5a6867d194162",
99 | "subnet-0eea17cb6af21b5e5",
100 | "subnet-02822dcd2e06634cf",
101 | },
102 | "vpc_id": "vpc-0d9ff66ccda7c9765",
103 | },
104 | "bucketArn": "arn:aws:s3:::hello-world-abc12345",
105 | "firstSubnetId": "subnet-023a5a6867d194162",
106 | },
107 | },
108 | "remote": {
109 | expectedStackOutputs: map[string]any{
110 | "state": map[string]any{
111 | "4dabf18193072939515e22adb298388d": "1b47061264138c4ac30d75fd1eb44270",
112 | "plaintext": "{\"password\":\"EOZcr9x4V@ep8T1gjmR4RJ39aT9vQDsDwZx\"}",
113 | },
114 | },
115 | },
116 | }
117 |
118 | examplesDir := "."
119 | examples, err := os.ReadDir(examplesDir)
120 | require.NoError(t, err)
121 |
122 | for _, dir := range examples {
123 | if !dir.IsDir() {
124 | continue
125 | }
126 |
127 | testDir := filepath.Join(examplesDir, dir.Name(), language)
128 | _, err := os.Stat(testDir)
129 | if os.IsNotExist(err) {
130 | continue
131 | }
132 | require.NoError(t, err)
133 |
134 | // We have found a yaml example called dir.Name, so we should run it async.
135 | t.Run(dir.Name(), func(t *testing.T) {
136 | test := tests[dir.Name()]
137 | var config map[string]string
138 | if !test.doesNotNeedConfig {
139 | config = map[string]string{
140 | "remote_tf_token": getRemoteBackendToken(t),
141 | "remote_tf_org": getRemoteBackendOrganization(t),
142 | }
143 | }
144 | opts := integration.ProgramTestOptions{
145 | Dir: testDir,
146 | DecryptSecretsInOutput: true,
147 | Config: config,
148 | LocalProviders: []integration.LocalDependency{{
149 | Package: "terraform",
150 | Path: "../bin",
151 | }},
152 | Dependencies: getDependencies(t, language),
153 | ExtraRuntimeValidation: func(t *testing.T, stack integration.RuntimeValidationStackInfo) {
154 | assert.Equal(t, test.expectedStackOutputs, stack.Outputs)
155 | },
156 | }
157 | integration.ProgramTest(t, &opts)
158 | })
159 | }
160 | }
161 |
--------------------------------------------------------------------------------
/examples/examples_yaml_test.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016-2025, Pulumi Corporation. All rights reserved.
2 | //go:build yaml || all
3 | // +build yaml all
4 |
5 | package examples
6 |
7 | import (
8 | "testing"
9 | )
10 |
11 | func TestYAML(t *testing.T) {
12 | t.Parallel()
13 | LanguageTests(t, "yaml")
14 | }
15 |
--------------------------------------------------------------------------------
/examples/local/dotnet/Program.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Pulumi;
3 | using Pulumi.Terraform.State;
4 |
5 | return await Deployment.RunAsync(() =>
6 | {
7 | var outputs = GetLocalReference.Invoke(new GetLocalReferenceInvokeArgs
8 | {
9 | Path = "./terraform.0-12-24.tfstate",
10 | }).Apply(x => x.Outputs);
11 |
12 | // Export outputs here
13 | return new Dictionary
14 | {
15 | ["state"] = outputs,
16 | ["bucketArn"] = outputs.Apply(x => x["bucket_arn"]),
17 | ["firstSubnetId"] = outputs.Apply(x => (x["public_subnet_ids"] as IList