Skip to content

Commit

Permalink
Fix projectId
Browse files Browse the repository at this point in the history
  • Loading branch information
yufeiminds committed Jun 24, 2021
1 parent 65e06d2 commit 6a19365
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion examples/csharp/ucloud/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class MyApp : TerraformStack
public MyApp(Construct scope, string id) : base(scope, id)
{
new UcloudProvider(this, "ucloud", new UcloudProviderConfig {
Region = "cn-bj2"
Region = "cn-bj2",
ProjectId = System.Environment.GetEnvironmentVariable("UCLOUD_PROJECT_ID"),
});

DataUcloudImages images = new DataUcloudImages(this, "images", new DataUcloudImagesConfig {
Expand Down
Binary file removed examples/go/ucloud/.main.go.swp
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ public class Main extends TerraformStack {
public Main(final Construct scope, final String id) {
super(scope, id);

UcloudProvider.Builder.create(this, "ucloud").region("cn-bj2").build();
UcloudProvider.Builder.create(this, "ucloud")
.region("cn-bj2")
.projectId(System.getenv("UCLOUD_PROJECT_ID"))
.build();

DataUcloudImages images = DataUcloudImages.Builder.create(this, "images")
.availabilityZone("cn-bj2-04")
Expand Down
7 changes: 6 additions & 1 deletion examples/python/ucloud/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python
import os
from constructs import Construct
from cdktf import App, TerraformStack
from imports.ucloud import DataUcloudImages, Instance, UcloudProvider
Expand All @@ -8,7 +9,11 @@ class MyStack(TerraformStack):
def __init__(self, scope: Construct, ns: str):
super().__init__(scope, ns)

UcloudProvider(self, "UCloud", region="cn-bj2")
UcloudProvider(
self, "UCloud",
region="cn-bj2",
project_id=os.getenv("UCLOUD_PROJECT_ID"),
)
images = DataUcloudImages(
self, "images",
availability_zone="cn-bj2-04",
Expand Down
1 change: 1 addition & 0 deletions examples/typescript/ucloud/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class MyStack extends TerraformStack {

new UcloudProvider(this, 'UCloud', {
region: 'cn-bj2',
projectId: process.env.NODE_ENV,
})

let images = new DataUcloudImages(this, 'images', {
Expand Down

0 comments on commit 6a19365

Please sign in to comment.