microsoft-cdktfconstructs


Namemicrosoft-cdktfconstructs JSON
Version 0.0.3.dev12 PyPI version JSON
download
home_pagehttps://github.com/azure/terraform-cdk-constructs.git
SummaryA collection of CDK modules for provisioning and managing Terraform resources efficiently.
upload_time2024-07-15 17:48:31
maintainerNone
docs_urlNone
authorMicrosoft
requires_python~=3.8
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Azure Terraform CDK Constructs

Welcome to the Azure Terraform CDK Constructs project! This library offers a comprehensive suite of L2 Constructs designed to simplify and enhance the experience of building and managing Azure infrastructure with the Cloud Development Kit for Terraform (CDKTF).

## Benefits of Using L2 Constructs

With L2 Constructs, you get the following benefits:

* **Abstraction**: Higher-level abstractions over Azure resources make your infrastructure code more declarative and easier to understand.
* **Reusability**: Encapsulate common patterns and best practices in your infrastructure code, promoting reusability across different projects and teams.
* **Rapid Development**: Accelerate your cloud development process with pre-built constructs that have been tested for common use cases, allowing you to focus on your unique application logic.
* **Direct IDE Integration**: Access detailed documentation directly within your Integrated Development Environment (IDE), streamlining your development workflow: ![alt text](https://raw.githubusercontent.com/Azure/terraform-cdk-constructs/main/docs/images/ide-documentation.png)

## Quick Example

This is a quick example that showcases the simplicity and power of L2 Constructs. We'll create a storage account, add a container to it, and then upload a blob—all with a few lines of intuitive, object-oriented code:

```python

// Create a new instance of a storage account as an object
const sa = new azcdk.azure_storageaccount.Account(stack, "storageaccount", {
  name: "testStorageAccount",
  location: "eastus",
});

// Add a container to the storage account by calling a method on the storage account object
const container = sa.addContainer("testcontainer");

// Add a blob to the container by calling a method on the container object
// The path "../../../test.txt" points to the source file to be uploaded as a blob
container.addBlob("testblob.txt", "../../../test.txt");
```

## Getting Started

This guide will walk you through the process of using the Azure L2 Constructs to define and provision infrastructure on Azure.

### Prerequisites

Make sure you have Node.js and npm installed on your machine. These will be used to install the CDK for Terraform and Azure provider packages.

### Installation

First, install the CDK for Terraform CLI globally using npm:

```sh
npm install -g cdktf-cli
```

Next, initialize a new CDK for Terraform project with TypeScript template:

```sh
cdktf init --template="TypeScript" --local
```

Install the AzureRM provider for CDKTF:

```sh
npm install @cdktf/provider-azurerm
```

Then, add the Microsoft Terraform CDK constructs for Azure:

```sh
npm install @micrsoft/terraform-cdk-constructs

```

### Example 1: Creating a Storage Account

Now let's create a simple Azure storage account. The following TypeScript snippet defines a storage account resource using the CDKTF:

```python
// Import necessary modules and classes
import * as azcdk from "@microsoft/terraform-cdk-constructs";
import { Construct } from 'constructs';
import { App, TerraformStack } from 'cdktf';
import { AzurermProvider } from "@cdktf/provider-azurerm/lib/provider";

// Define a new Terraform stack
class AzureAppInfra extends TerraformStack {
 constructor(scope: Construct, name: string) {
   super(scope, name);

   // Initialize Azure provider
   new AzurermProvider(this, "azureFeature", { features: {} });

   // Create a new Azure storage account with the specified name and location
   new azcdk.azure_storageaccount.Account(this, "storageaccount", {
     name: "test42348808",
     location: "eastus",
   });
 }
}

// Initialize the CDK app and synthesize Terraform configurations
const app = new App();
new AzureAppInfra(app, 'cdk');
app.synth();
```

After defining your infrastructure, generate the Terraform configuration files:

```sh
cdktf synth
```

Finally, deploy your infrastructure to Azure:

```sh
cdktf deploy
```

## Supported Languages

Currently, our CDK L2 constructs are available in the following languages:

| Language   | Status       |
|------------|--------------|
| TypeScript | [Available](https://www.npmjs.com/package/@microsoft/terraform-cdk-constructs)    |
| Python     | [Available](https://pypi.org/project/microsoft-cdktfconstructs/)  |
| Java       | Coming soon  |
| C#         | [Available](https://www.nuget.org/packages/Microsoft.Cdktf.Azure.TFConstructs)  |

Stay tuned for updates as we work to expand support to other popular programming languages!

## Contributing

This project welcomes contributions and suggestions.  Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

We welcome contributions to this project! See our documentation on [how to get started contributing](./docs/CONTRIBUTING.md).

## Code Spaces

To open this repository in a Code Space, click the button below:

[![Open in Code Spaces](https://img.shields.io/badge/Open%20in%20Code%20Spaces-Terraform%20Azure%20CDK%20Modules%20Project-blue?logo=github)](https://github.com/microsoft/terraform-azure-cdk-modules/codespaces)

## Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft
trademarks or logos is subject to and must follow
[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
Any use of third-party trademarks or logos are subject to those third-party's policies.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/azure/terraform-cdk-constructs.git",
    "name": "microsoft-cdktfconstructs",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "~=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Microsoft",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/98/11/ad7eac85faa17a5f7b1827e9ddcf2ec1a5f485168686ca521ccb488c9d74/microsoft-cdktfconstructs-0.0.3.dev12.tar.gz",
    "platform": null,
    "description": "# Azure Terraform CDK Constructs\n\nWelcome to the Azure Terraform CDK Constructs project! This library offers a comprehensive suite of L2 Constructs designed to simplify and enhance the experience of building and managing Azure infrastructure with the Cloud Development Kit for Terraform (CDKTF).\n\n## Benefits of Using L2 Constructs\n\nWith L2 Constructs, you get the following benefits:\n\n* **Abstraction**: Higher-level abstractions over Azure resources make your infrastructure code more declarative and easier to understand.\n* **Reusability**: Encapsulate common patterns and best practices in your infrastructure code, promoting reusability across different projects and teams.\n* **Rapid Development**: Accelerate your cloud development process with pre-built constructs that have been tested for common use cases, allowing you to focus on your unique application logic.\n* **Direct IDE Integration**: Access detailed documentation directly within your Integrated Development Environment (IDE), streamlining your development workflow: ![alt text](https://raw.githubusercontent.com/Azure/terraform-cdk-constructs/main/docs/images/ide-documentation.png)\n\n## Quick Example\n\nThis is a quick example that showcases the simplicity and power of L2 Constructs. We'll create a storage account, add a container to it, and then upload a blob\u2014all with a few lines of intuitive, object-oriented code:\n\n```python\n\n// Create a new instance of a storage account as an object\nconst sa = new azcdk.azure_storageaccount.Account(stack, \"storageaccount\", {\n  name: \"testStorageAccount\",\n  location: \"eastus\",\n});\n\n// Add a container to the storage account by calling a method on the storage account object\nconst container = sa.addContainer(\"testcontainer\");\n\n// Add a blob to the container by calling a method on the container object\n// The path \"../../../test.txt\" points to the source file to be uploaded as a blob\ncontainer.addBlob(\"testblob.txt\", \"../../../test.txt\");\n```\n\n## Getting Started\n\nThis guide will walk you through the process of using the Azure L2 Constructs to define and provision infrastructure on Azure.\n\n### Prerequisites\n\nMake sure you have Node.js and npm installed on your machine. These will be used to install the CDK for Terraform and Azure provider packages.\n\n### Installation\n\nFirst, install the CDK for Terraform CLI globally using npm:\n\n```sh\nnpm install -g cdktf-cli\n```\n\nNext, initialize a new CDK for Terraform project with TypeScript template:\n\n```sh\ncdktf init --template=\"TypeScript\" --local\n```\n\nInstall the AzureRM provider for CDKTF:\n\n```sh\nnpm install @cdktf/provider-azurerm\n```\n\nThen, add the Microsoft Terraform CDK constructs for Azure:\n\n```sh\nnpm install @micrsoft/terraform-cdk-constructs\n\n```\n\n### Example 1: Creating a Storage Account\n\nNow let's create a simple Azure storage account. The following TypeScript snippet defines a storage account resource using the CDKTF:\n\n```python\n// Import necessary modules and classes\nimport * as azcdk from \"@microsoft/terraform-cdk-constructs\";\nimport { Construct } from 'constructs';\nimport { App, TerraformStack } from 'cdktf';\nimport { AzurermProvider } from \"@cdktf/provider-azurerm/lib/provider\";\n\n// Define a new Terraform stack\nclass AzureAppInfra extends TerraformStack {\n constructor(scope: Construct, name: string) {\n   super(scope, name);\n\n   // Initialize Azure provider\n   new AzurermProvider(this, \"azureFeature\", { features: {} });\n\n   // Create a new Azure storage account with the specified name and location\n   new azcdk.azure_storageaccount.Account(this, \"storageaccount\", {\n     name: \"test42348808\",\n     location: \"eastus\",\n   });\n }\n}\n\n// Initialize the CDK app and synthesize Terraform configurations\nconst app = new App();\nnew AzureAppInfra(app, 'cdk');\napp.synth();\n```\n\nAfter defining your infrastructure, generate the Terraform configuration files:\n\n```sh\ncdktf synth\n```\n\nFinally, deploy your infrastructure to Azure:\n\n```sh\ncdktf deploy\n```\n\n## Supported Languages\n\nCurrently, our CDK L2 constructs are available in the following languages:\n\n| Language   | Status       |\n|------------|--------------|\n| TypeScript | [Available](https://www.npmjs.com/package/@microsoft/terraform-cdk-constructs)    |\n| Python     | [Available](https://pypi.org/project/microsoft-cdktfconstructs/)  |\n| Java       | Coming soon  |\n| C#         | [Available](https://www.nuget.org/packages/Microsoft.Cdktf.Azure.TFConstructs)  |\n\nStay tuned for updates as we work to expand support to other popular programming languages!\n\n## Contributing\n\nThis project welcomes contributions and suggestions.  Most contributions require you to agree to a\nContributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us\nthe rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.\n\nWhen you submit a pull request, a CLA bot will automatically determine whether you need to provide\na CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions\nprovided by the bot. You will only need to do this once across all repos using our CLA.\n\nThis project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).\nFor more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or\ncontact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.\n\nWe welcome contributions to this project! See our documentation on [how to get started contributing](./docs/CONTRIBUTING.md).\n\n## Code Spaces\n\nTo open this repository in a Code Space, click the button below:\n\n[![Open in Code Spaces](https://img.shields.io/badge/Open%20in%20Code%20Spaces-Terraform%20Azure%20CDK%20Modules%20Project-blue?logo=github)](https://github.com/microsoft/terraform-azure-cdk-modules/codespaces)\n\n## Trademarks\n\nThis project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft\ntrademarks or logos is subject to and must follow\n[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).\nUse of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.\nAny use of third-party trademarks or logos are subject to those third-party's policies.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A collection of CDK modules for provisioning and managing Terraform resources efficiently.",
    "version": "0.0.3.dev12",
    "project_urls": {
        "Homepage": "https://github.com/azure/terraform-cdk-constructs.git",
        "Source": "https://github.com/azure/terraform-cdk-constructs.git"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "8aa2b5af260b4d8493cf7432eacbf04ae693aba3572c6b57411656ed0a413fa3",
                "md5": "116ea0608f5034893b82c63c8f246bbc",
                "sha256": "3fe2de593e1564804cecab8e4293f87f5ef0ed9c34c6cf3085966bcc51d21760"
            },
            "downloads": -1,
            "filename": "microsoft_cdktfconstructs-0.0.3.dev12-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "116ea0608f5034893b82c63c8f246bbc",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "~=3.8",
            "size": 1639222,
            "upload_time": "2024-07-15T17:48:33",
            "upload_time_iso_8601": "2024-07-15T17:48:33.920681Z",
            "url": "https://files.pythonhosted.org/packages/8a/a2/b5af260b4d8493cf7432eacbf04ae693aba3572c6b57411656ed0a413fa3/microsoft_cdktfconstructs-0.0.3.dev12-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "9811ad7eac85faa17a5f7b1827e9ddcf2ec1a5f485168686ca521ccb488c9d74",
                "md5": "4699df25b62941191a4e41cf193d1d3b",
                "sha256": "5c3c604adbccc42f6011bc1a7920f89b271e5b25782c383a0b786be1b4048a64"
            },
            "downloads": -1,
            "filename": "microsoft-cdktfconstructs-0.0.3.dev12.tar.gz",
            "has_sig": false,
            "md5_digest": "4699df25b62941191a4e41cf193d1d3b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "~=3.8",
            "size": 1628579,
            "upload_time": "2024-07-15T17:48:31",
            "upload_time_iso_8601": "2024-07-15T17:48:31.647871Z",
            "url": "https://files.pythonhosted.org/packages/98/11/ad7eac85faa17a5f7b1827e9ddcf2ec1a5f485168686ca521ccb488c9d74/microsoft-cdktfconstructs-0.0.3.dev12.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-15 17:48:31",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "azure",
    "github_project": "terraform-cdk-constructs",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "microsoft-cdktfconstructs"
}
        
Elapsed time: 0.69011s