Generate a random string for aws-ts-appsync datasource name
MODIFY
aws-py-appsync/__main__.py
aws-py-appsync/__main__.py
import json
+import pulumi_random as random
from pulumi import export
from pulumi_aws import dynamodb, iam, appsync
## Dynamo DB table to hold data for the GraphQL endpoint
table = dynamodb.Table(
"tenants",
- name="Tenant",
hash_key="id",
attributes=[{
"name": "id",
@@ -79,10 +79,16 @@ api_key = appsync.ApiKey(
"key",
api_id=api.id)
+random_string = random.RandomString(
+ "random-datasource-name",
+ length=15,
+ special="false",
+)
+
## Link a data source to the Dynamo DB Table
data_source = appsync.DataSource(
"tenants-ds",
- name="TenantsDataSource",
+ name=random_string.result,
api_id=api.id,
type="AMAZON_DYNAMODB",
dynamodb_config={

MODIFY
aws-py-appsync/requirements.txt
aws-py-appsync/requirements.txt
pulumi>=1.0.0
pulumi-aws>=1.0.0
+pulumi-random>=1.0.0

MODIFY
aws-ts-appsync/index.ts
aws-ts-appsync/index.ts
// Copyright 2016-2019, Pulumi Corporation. All rights reserved.
import * as aws from "@pulumi/aws";
+import * as random from "@pulumi/random";
import { createIamRole } from "./iam";
// Dynamo DB table to hold data for the GraphQL endpoint
@@ -43,8 +44,14 @@ const apiKey = new aws.appsync.ApiKey("key", {
apiId: api.id,
});
+const randomString = new random.RandomString("random-datasource-name", {
+ length: 15,
+ special: false,
+});
+
// Link a data source to the Dynamo DB Table
const dataSource = new aws.appsync.DataSource("tenants-ds", {
+ name: randomString.result,
apiId: api.id,
type: "AMAZON_DYNAMODB",
dynamodbConfig: {

MODIFY
aws-ts-appsync/package.json
aws-ts-appsync/package.json
"version": "0.1.0",
"dependencies": {
"@pulumi/aws": "^1.0.0",
- "@pulumi/pulumi": "^1.0.0"
+ "@pulumi/pulumi": "^1.0.0",
+ "@pulumi/random": "^1.0.0"
}
}

MODIFY
misc/test/examples_test.go
misc/test/examples_test.go
@@ -176,15 +176,12 @@ func TestExamples(t *testing.T) {
})
},
}),
-
- // aws-ts-apigateway-auth0 requires manual interaction with auth0
-
- //base.With(integration.ProgramTestOptions{
- // Dir: path.Join(cwd, "..", "..", "aws-ts-appsync"),
- // Config: map[string]string{
- // "aws:region": awsRegion,
- // },
- //}),
+ base.With(integration.ProgramTestOptions{
+ Dir: path.Join(cwd, "..", "..", "aws-ts-appsync"),
+ Config: map[string]string{
+ "aws:region": awsRegion,
+ },
+ }),
base.With(integration.ProgramTestOptions{
Dir: path.Join(cwd, "..", "..", "aws-ts-assume-role", "create-role"),
Config: map[string]string{
@@ -192,9 +189,6 @@ func TestExamples(t *testing.T) {
"create-role:unprivilegedUsername": "unpriv",
},
}),
-
- // aws-ts-assume-role/assume-role requires output of aws-ts-assume-role/create-role
-
base.With(integration.ProgramTestOptions{
Dir: path.Join(cwd, "..", "..", "aws-ts-containers"),
Config: map[string]string{

Generate a random string for aws-ts-appsync datasource name (#418)