Skip to content

Commit

Permalink
Merge pull request #110 from pulumi/stack72/pulumi-v2.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
stack72 authored Aug 21, 2020
2 parents 090155f + 9f1cb72 commit 7f11c8a
Show file tree
Hide file tree
Showing 22 changed files with 777 additions and 371 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ CHANGELOG
=========

## HEAD (Unreleased)
_(none)_
* Upgrade to Pulumi v2.9.0, which adds type annotations and input/output classes to Python
* Upgrade to pulumi-terraform-bridge v2.7.2

---

Expand Down
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ build_dotnet:: install_plugins tfgen # build the dotnet sdk
echo "${DOTNET_VERSION}" >version.txt && \
dotnet build /p:Version=${DOTNET_VERSION}

build_go:: install_plugins tfgen # build the go sdk
$(WORKING_DIR)/bin/$(TFGEN) go --overlays provider/overlays/go --out sdk/go/

lint_provider:: provider # lint the provider code
cd provider && golangci-lint run -c ../.golangci.yml

Expand Down
11 changes: 6 additions & 5 deletions provider/cmd/pulumi-resource-random/schema.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions provider/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ go 1.14

require (
github.com/hashicorp/terraform-plugin-sdk v1.11.0
github.com/pulumi/pulumi-terraform-bridge/v2 v2.5.2
github.com/pulumi/pulumi/sdk/v2 v2.5.1-0.20200630091945-bb358c4d2173
github.com/pulumi/pulumi-terraform-bridge/v2 v2.7.2
github.com/pulumi/pulumi/sdk/v2 v2.9.1-0.20200821035132-629254334213
github.com/terraform-providers/terraform-provider-random v0.0.0-20190925210718-83518d96ae4f
)

Expand Down
130 changes: 130 additions & 0 deletions provider/go.sum

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion provider/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ func Provider() tfbridge.ProviderInfo {
},
Python: &tfbridge.PythonInfo{
Requires: map[string]string{
"pulumi": ">=2.0.0,<3.0.0",
"pulumi": ">=2.9.0,<3.0.0",
},
UsesIOClasses: true,
},
CSharp: &tfbridge.CSharpInfo{
PackageReferences: map[string]string{
Expand Down
10 changes: 10 additions & 0 deletions sdk/dotnet/Pulumi.Random.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@
<NoWarn>1701;1702;1591</NoWarn>
</PropertyGroup>

<PropertyGroup>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="version.txt" />
<Content Include="version.txt" />
Expand Down
45 changes: 0 additions & 45 deletions sdk/go/random/randomId.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,51 +22,6 @@ import (
// the `createBeforeDestroy` lifecycle flag set to avoid conflicts with
// unique names during the brief period where both the old and new resources
// exist concurrently.
//
// ## Example Usage
//
// The following example shows how to generate a unique name for an AWS EC2
// instance that changes each time a new AMI id is selected.
//
// ```go
// package main
//
// import (
// "fmt"
//
// "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/ec2"
// "github.com/pulumi/pulumi-random/sdk/v2/go/random"
// "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// serverRandomId, err := random.NewRandomId(ctx, "serverRandomId", &random.RandomIdArgs{
// ByteLength: pulumi.Int(8),
// Keepers: pulumi.StringMap{
// "ami_id": pulumi.String(_var.Ami_id),
// },
// })
// if err != nil {
// return err
// }
// _, err = ec2.NewInstance(ctx, "serverInstance", &ec2.InstanceArgs{
// Ami: pulumi.String(serverRandomId.Keepers.ApplyT(func(keepers map[string]string) (string, error) {
// return keepers.AmiId, nil
// }).(pulumi.StringOutput)),
// Tags: pulumi.StringMap{
// "Name": serverRandomId.Hex.ApplyT(func(hex string) (string, error) {
// return fmt.Sprintf("%v%v", "web-server ", hex), nil
// }).(pulumi.StringOutput),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
type RandomId struct {
pulumi.CustomResourceState

Expand Down
8 changes: 4 additions & 4 deletions sdk/go/random/randomInteger.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ import (
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// priority, err := random.NewRandomInteger(ctx, "priority", &random.RandomIntegerArgs{
// Keepers: pulumi.StringMap{
// "listener_arn": pulumi.String(_var.Listener_arn),
// Keepers: pulumi.AnyMap{
// "listener_arn": pulumi.Any(_var.Listener_arn),
// },
// Max: pulumi.Int(50000),
// Min: pulumi.Int(1),
Expand All @@ -46,11 +46,11 @@ import (
// _, err = alb.NewListenerRule(ctx, "main", &alb.ListenerRuleArgs{
// Actions: alb.ListenerRuleActionArray{
// &alb.ListenerRuleActionArgs{
// TargetGroupArn: pulumi.String(_var.Target_group_arn),
// TargetGroupArn: pulumi.Any(_var.Target_group_arn),
// Type: pulumi.String("forward"),
// },
// },
// ListenerArn: pulumi.String(_var.Listener_arn),
// ListenerArn: pulumi.Any(_var.Listener_arn),
// Priority: priority.Result,
// })
// if err != nil {
Expand Down
47 changes: 0 additions & 47 deletions sdk/go/random/randomPet.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,53 +16,6 @@ import (
// the `createBeforeDestroy` lifecycle flag set, to avoid conflicts with
// unique names during the brief period where both the old and new resources
// exist concurrently.
//
// ## Example Usage
//
// The following example shows how to generate a unique pet name for an AWS EC2
// instance that changes each time a new AMI id is selected.
//
// ```go
// package main
//
// import (
// "fmt"
//
// "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/ec2"
// "github.com/pulumi/pulumi-random/sdk/v2/go/random"
// "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// serverRandomPet, err := random.NewRandomPet(ctx, "serverRandomPet", &random.RandomPetArgs{
// Keepers: pulumi.StringMap{
// "ami_id": pulumi.String(_var.Ami_id),
// },
// })
// if err != nil {
// return err
// }
// _, err = ec2.NewInstance(ctx, "serverInstance", &ec2.InstanceArgs{
// Ami: pulumi.String(serverRandomPet.Keepers.ApplyT(func(keepers map[string]string) (string, error) {
// return keepers.AmiId, nil
// }).(pulumi.StringOutput)),
// Tags: pulumi.StringMap{
// "Name": serverRandomPet.ID().ApplyT(func(id string) (string, error) {
// return fmt.Sprintf("%v%v", "web-server-", id), nil
// }).(pulumi.StringOutput),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// The result of the above will set the Name of the AWS Instance to
// `web-server-simple-snake`.
type RandomPet struct {
pulumi.CustomResourceState

Expand Down
2 changes: 2 additions & 0 deletions sdk/nodejs/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ export class Provider extends pulumi.ProviderResource {
*/
constructor(name: string, args?: ProviderArgs, opts?: pulumi.ResourceOptions) {
let inputs: pulumi.Inputs = {};
{
}
if (!opts) {
opts = {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

_SNAKE_TO_CAMEL_CASE_TABLE = {
SNAKE_TO_CAMEL_CASE_TABLE = {
"b64_std": "b64Std",
"b64_url": "b64Url",
"byte_length": "byteLength",
Expand All @@ -14,7 +14,7 @@
"result_count": "resultCount",
}

_CAMEL_TO_SNAKE_CASE_TABLE = {
CAMEL_TO_SNAKE_CASE_TABLE = {
"b64Std": "b64_std",
"b64Url": "b64_url",
"byteLength": "byte_length",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def get_env_float(*args):

def get_version():
# __name__ is set to the fully-qualified name of the current module, In our case, it will be
# <some module>.utilities. <some module> is the module we want to query the version for.
# <some module>._utilities. <some module> is the module we want to query the version for.
root_package, *rest = __name__.split('.')

# pkg_resources uses setuptools to inspect the set of installed packages. We use it here to ask
Expand Down
20 changes: 14 additions & 6 deletions sdk/python/pulumi_random/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,19 @@
import warnings
import pulumi
import pulumi.runtime
from typing import Union
from . import utilities, tables
from typing import Any, Dict, List, Mapping, Optional, Tuple, Union
from . import _utilities, _tables

__all__ = ['Provider']


class Provider(pulumi.ProviderResource):
def __init__(__self__, resource_name, opts=None, __props__=None, __name__=None, __opts__=None):
def __init__(__self__,
resource_name,
opts: Optional[pulumi.ResourceOptions] = None,
__props__=None,
__name__=None,
__opts__=None):
"""
The provider type for the random package. By default, resources use package-wide configuration
settings, however an explicit `Provider` instance may be created and passed during resource
Expand All @@ -31,7 +38,7 @@ def __init__(__self__, resource_name, opts=None, __props__=None, __name__=None,
if not isinstance(opts, pulumi.ResourceOptions):
raise TypeError('Expected resource options to be a ResourceOptions instance')
if opts.version is None:
opts.version = utilities.get_version()
opts.version = _utilities.get_version()
if opts.id is None:
if __props__ is not None:
raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
Expand All @@ -44,7 +51,8 @@ def __init__(__self__, resource_name, opts=None, __props__=None, __name__=None,
opts)

def translate_output_property(self, prop):
return tables._CAMEL_TO_SNAKE_CASE_TABLE.get(prop) or prop
return _tables.CAMEL_TO_SNAKE_CASE_TABLE.get(prop) or prop

def translate_input_property(self, prop):
return tables._SNAKE_TO_CAMEL_CASE_TABLE.get(prop) or prop
return _tables.SNAKE_TO_CAMEL_CASE_TABLE.get(prop) or prop

Loading

0 comments on commit 7f11c8a

Please sign in to comment.