Skip to content

Commit

Permalink
Merge pull request #17 from tencentcloudstack/doc/improvement
Browse files Browse the repository at this point in the history
doc: add docs for website, optimize existing documents.
  • Loading branch information
Kagashino authored Oct 26, 2022
2 parents 91c21ed + 0514d7a commit fcd8958
Show file tree
Hide file tree
Showing 78 changed files with 628 additions and 396 deletions.
31 changes: 17 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# TencentCloud Resource Provider
# Pulumi TencentCloud Resource Provider

The TencentCloud Resource Provider lets you manage [TencentCloud](https://cloud.tencent.com/) resources.
The Pulumi TencentCloud Resource Provider lets you manage [TencentCloud](https://www.tencentcloud.com/) resources.

## Installing

### Install tencentcloud provider

The sdks installation will fully support package auto download in the future, now we recommend downloading manually:
The sdks installation will fully support package auto download in the future, but now we recommend downloading manually:

```bash
pulumi plugin install resource tencentcloud --server github://api.github.com/tencentcloudstack
Expand Down Expand Up @@ -51,24 +51,27 @@ The following configuration points are available for the `tencentcloud` provider
#### Secret ID
The API Secret ID, read from environment variable `TENCENTCLOUD_SECRET_ID` if not preset.

$ pulumi config set tencentcloud:secretId [your-secret-id] --secret

```bash
pulumi config set tencentcloud:secretId [your-secret-id] --secret
```
#### Secret Key
The API Secret Key, read from environment variable `TENCENTCLOUD_SECRET_KEY` if not preset.

$ pulumi config set tencentcloud:secretKey [your-secret-key] --secret

#### Security Token
The Security Token for temporary access, read from environment variable `TENCENTCLOUD_SECURITY_TOKEN` if not preset.

$ pulumi config set tencentcloud:securityToken [your-security-token] --secret
```bash
pulumi config set tencentcloud:secretKey [your-secret-key] --secret
```

#### Region
The region in which to deploy resources, read from environment variable `TENCENTCLOUD_REGION` if not preset.

$ pulumi config set tencentcloud:region ap-singapore
```bash
pulumi config set tencentcloud:region ap-singapore
```

#### Security Token (Optional)
The Security Token for temporary access, read from environment variable `TENCENTCLOUD_SECURITY_TOKEN` if not preset.

## Reference
```bash
pulumi config set tencentcloud:securityToken [your-security-token] --secret
```

For detailed reference documentation, please visit [the Pulumi registry](https://www.pulumi.com/registry/packages/tencentcloud/api-docs/).
110 changes: 110 additions & 0 deletions docs/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
---
title: TencentCloud
meta_desc: Provides an overview of the Tencent Cloud Provider for Pulumi.
layout: overview
---

The Tencent Cloud provider for Pulumi can be used to provision any of the cloud resources available in [Tencent Cloud](https://tencentcloud.com).
The Tencent Cloud provider must be configured with credentials to deploy and update resources in Tencent Cloud.

## Examples

These examples show how to use multi-language to create a COS Bucket.

{{< chooser language "javascript,typescript,python,go,csharp" >}}

{{% choosable language javascript %}}

```javascript
const tencentcloud = require("@tencentcloud_iac/pulumi");

~async function () {
const info = await tencentcloud.user.getInfo();
const myBucket = new tencentcloud.cos.Bucket("myBucket", {
acl: "private",
bucket: `pulumi-created-${info.appId}`,
});
}()

```

{{% /choosable %}} {{% choosable language typescript %}}

```typescript
import * as tencentcloud from "@tencentcloud_iac/pulumi";

~async function () {
const info = await tencentcloud.user.getInfo();
const myBucket = new tencentcloud.cos.Bucket("myBucket", {
acl: "private",
bucket: `pulumi-created-${info.appId}`,
});
}()
```

{{% /choosable %}} {{% choosable language python %}}

```python
import tencentcloud_iac_pulumi as tencentcloud

info = tencentcloud.user.get_info()
my_bucket = tencentcloud.cos.Bucket("myBucket",
acl="private",
bucket=f"pulumi-created-{info.app_id}")

```

{{% /choosable %}} {{% choosable language go %}}

```go
package main

import (
"fmt"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/tencentcloudstack/pulumi-tencentcloud/sdk/go/tencentcloud/cos"
"github.com/tencentcloudstack/pulumi-tencentcloud/sdk/go/tencentcloud/user"
)

func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
info, err := user.GetInfo(ctx, nil, nil)
if err != nil {
return err
}
_, err = cos.NewBucket(ctx, "myBucket", &Cos.BucketArgs{
Acl: pulumi.String("private"),
Bucket: pulumi.String(fmt.Sprintf("%v%v", "pulumi-created-", info.AppId)),
})
if err != nil {
return err
}
return nil
})
}
```

{{% /choosable %}} {{% choosable language csharp %}}

```csharp
using Tencentcloud = TencentcloudIAC.PulumiPackage.TencentCloud;

class MyStack : Stack
{
public MyStack()
{
var info = Output.Create(Tencentcloud.User.GetInfo.InvokeAsync());
var myBucket = new Tencentcloud.Cos.Bucket("myBucket", new Tencentcloud.Cos.BucketArgs
{
Acl = "private",
Bucket = info.Apply(info => $"pulumi-created-{info.AppId}"),
});
}

}

```

{{% /choosable %}}

{{< /chooser >}}
44 changes: 44 additions & 0 deletions docs/installation-configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
title: TencentCloud Setup
meta_desc: Provides an overview on how to configure credentials and region for the Pulumi Tencent Cloud Provider
layout: installation
---

The Pulumi Tencent Cloud Provider uses Tencent Cloud SDK to manage and provision resources.

## Installation

The Tencent Cloud provider is available as a package in the following Pulumi languages:

- JavaScript/TypeScript: [@tencentcloud_iac/pulumi](https://www.npmjs.com/package/@tencentcloud_iac/pulumi)
- Python: [tencentcloud-iac-pulumi](https://pypi.org/manage/project/tencentcloud-iac-pulumi/releases)
- Go: [github.com/tencentcloudstack/pulumi-tencentcloud/sdk/go](github.com/tencentcloudstack/pulumi-tencentcloud/sdk/go)
- .Net: [TencentCloudIAC.PulumiPackage.Tencentcloud](https://www.nuget.org/packages/TencentCloudIAC.PulumiPackage.Tencentcloud)

## Configurations

The following configuration are available for the `tencentcloud` provider:
- `secretId`: (Required) The API Secret ID.
- `secretIKey`: (Required) The API Secret Key.
- `region`: (Required) The region in which to deploy resources.
- `securityToken`: (Optional) The Security Token for temporary access.

Run `pulumi config set` to configure:

```bash
pulumi config set tencentcloud:secretId <your_secret_id> --secret
pulumi config set tencentcloud:secretKey <your_secret_key> --secret
pulumi config set tencentcloud:region ap-singapore

pulumi config set tencentcloud:securityToken <your_security_token_if_needed> --secret
```

You can also configure these value by environment variables:

```bash
export TENCENTCLOUD_SECRET_ID=<your_secret_id>
export TENCENTCLOUD_SECRET_KEY=<your_secret_key>
export TENCENTCLOUD_REGION=ap-singapore

export TENCENTCLOUD_SECURITY_TOKEN=<your_secret_token_if_needed>
```
Loading

0 comments on commit fcd8958

Please sign in to comment.