Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cdktf-web

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cdktf-web

cdktf and its major providers for browsers

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

cdktf-web

Run Terraform-CDK in the browser.

Getting Started

npm install cdktf-web

Usage

After loading the scripts in browser, the following globals are available:

  • CDKTF: Exposes the cdktf package
  • CONSTRUCTS: Exposes the constructs package
  • CDKTF_PROVIDER_AWS: Exposes the @cdktf/provider-aws package
  • CDKTF_PROVIDER_GOOGLE: Exposes the @cdktf/provider-google package
  • CDKTF_PROVIDER_AZURERM: Exposes the @cdktf/provider-azurerm package

Load the scripts in your browser with a HTML like this:

<html>
  <head>
    <title>cdktf-web</title>
    <script src="node_modules/cdktf-web/dist/bundle.constructs.js"></script>
    <script src="node_modules/cdktf-web/dist/bundle.cdktf.js"></script>
    <script src="node_modules/cdktf-web/dist/bundle.cdktf-provider-aws.js"></script>
    <script src="node_modules/cdktf-web/dist/bundle.cdktf-provider-google.js"></script>
    <script src="node_modules/cdktf-web/dist/bundle.cdktf-provider-azurerm.js"></script>
  </head>
  <body></body>
</html>

And synthesize a sample stack:

const app = new CDKTF.App();
const stack = new CDKTF.TerraformStack(app, 'MyBrowserStack');
const provider = new CDKTF_PROVIDER_AWS.provider.AwsProvider(stack, 'AWS', {region: "us-west-1"});
const ec2Instance = new CDKTF_PROVIDER_AWS.instance.Instance(stack, "compute", {
  ami: "ami-01456a894f71116f2",
  instanceType: "t2.micro",
});
new CDKTF.TerraformOutput(stack, "public_ip", {
  value: ec2Instance.publicIp,
});
app.synth();
JSON.parse(CDKTF.fs.vol.toJSON()["/cdktf.out/stacks/MyBrowserStack/cdk.tf.json"]);

FAQs

Package last updated on 11 Nov 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc