
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@pulumi/terraform
Advanced tools
A Pulumi package for interoperating with infrastructure created with Terraform.
The Terraform resource provider for Pulumi lets you consume the outputs
contained in Terraform state files from your Pulumi programs. The package
provides a RemoteStateReference
resource which acts like a native Pulumi
StackReference
.
To use this package, please install the Pulumi CLI first.
To use from JavaScript or TypeScript in Node.js, install using either npm
:
$ npm install @pulumi/terraform
or yarn
:
$ yarn add @pulumi/terraform
To use from Python, install using pip
:
$ pip install pulumi-terraform
The @pulumi/terraform
package provides a resource named RemoteStateReference
which is used to read outputs from a Terraform state file stored in one of the
supported Terraform remote state backends.
The following program will read a Terraform state file stored in S3:
import * as tf from "@pulumi/terraform";
const remoteState = new tf.state.RemoteStateReference("s3state", {
backendType: "s3",
bucket: "pulumi-terraform-state-test",
key: "test/terraform.tfstate",
region: "us-west-2"
});
// Use the getOutput function on the resource to access root outputs
const vpcId= remoteState.getOutput("vpc_id");
The following program will read a Terraform state file stored locally in the filesystem:
import * as tf from "@pulumi/terraform";
const remotestate = new tf.state.RemoteStateReference("localstate", {
backendType: "local",
path: path.join(__dirname, "terraform.tfstate"),
});
// Use the getOutput function on the resource to access root outputs
const vpcId= remoteState.getOutput("vpc_id");
For state stored in Terraform Enterprise, the authentication token must be set via the Pulumi configuration system - for example, using:
pulumi config set --secret terraformEnterpriseToken <value>
The following program will read a Terraform state file stored in Terraform
Enterprise, using the value of terraformEnterpriseToken
from above:
import * as pulumi from "@pulumi/pulumi";
import * as tf from "@pulumi/terraform";
const config = new pulumi.Config();
const ref = new tf.state.RemoteStateReference("remote", {
backendType: "remote",
organization: "pulumi",
token: config.requireSecret("terraformEnterpriseToken"),
workspaces: {
name: "test-state-file"
}
});
// Use the getOutput function on the resource to access root outputs
const vpcId= remoteState.getOutput("vpc_id");
FAQs
A Pulumi package for interoperating with infrastructure created with Terraform.
The npm package @pulumi/terraform receives a total of 3,962 weekly downloads. As such, @pulumi/terraform popularity was classified as popular.
We found that @pulumi/terraform demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.