Commit graph

3654 commits

Author SHA1 Message Date
Matt Ellis e0f7dc17cd Guard against proj.Backend being nil 2019-06-13 16:26:31 -07:00
Artem Yarmoluk f1b5fb6e0f
Backend setting in project config
Signed-off-by: Artem Yarmoluk <koolgen@gmail.com>
2019-06-13 20:02:03 +03:00
CyrusNajmabadi b9c57858ed
Update changelog. (#2819) 2019-06-12 15:47:17 -07:00
CyrusNajmabadi 54cbda80c1
Store information about a CustomResource's provider in __providers. (#2816) 2019-06-11 16:57:37 -07:00
Matt Ellis bc9448b1cf Fix crash in pulumi stack output when stack is empty 2019-06-11 12:58:29 -07:00
Matt Ellis 01b9354336
Merge pull request #2797 from pulumi/ellismg/merge-2698
Fix a bug when logging into bucket urls
2019-06-10 14:06:35 -07:00
Matt Ellis f80c04c304 Run go mod tidy 2019-06-10 13:43:42 -07:00
Matt Ellis 1e519ce150 Fix a bug when logging into bucket urls
Currently if you log into s3://bucket/subdirectory, Pulumi will write
files to s3://bucket/.pulumi and not s3://bucket/subdirectory/.pulumi,
this corrects the error.
2019-06-10 13:43:17 -07:00
Mike Metral 803533d7d4 docs(login): escape codeblocks, and add object store state instructions 2019-06-07 10:37:06 -07:00
CyrusNajmabadi 8e0da42412
Remove logging code (#2807) 2019-06-07 01:47:24 -07:00
CyrusNajmabadi 55bb3b2486
Simplify API for passing providers to a ComponentResource. (#2609) 2019-06-06 16:20:12 -07:00
CyrusNajmabadi 71e8bfb61b
Use 'localhost' vs 0.0.0.0 (#2806) 2019-06-06 13:49:04 -07:00
Matt Ellis e8a5acf1f2 Prepare CHANGELOG.md for release 2019-06-06 10:35:24 -07:00
Pat Gavlin dfa120e6b4
Check for provider changes in mustWrite (#2805)
Recent changes to default provider semantics and the addition of
resource aliases allow a resource's provider reference to change even if
the resource itself is considered to have no diffs. `mustWrite` did not
expect this scenario, and indeed asserted against it. These changes
update `mustWrite` to detect such changes and require that the
checkpoint be written if and when they occur.

Fixes #2804.
2019-06-05 16:27:26 -07:00
Matt Ellis fdc4c64789 Update v0.17.15 release date 2019-06-05 09:39:11 -07:00
Matt Ellis 4e429592d6 Update CHANGELOG.md for release
[skip ci]
2019-06-04 11:39:19 -07:00
Erin Krengel 96f82f004f
Ekrengel/pac apitypes (#2798) 2019-06-04 10:27:53 -07:00
Alex Clemmer 02788b9b32 Implement listResourceOutputs in the Node.js SDK
This commit will expose the new `Invoke` routine that lists resource
outputs through the Node.js SDK.

This API is implemented via a new API, `EnumerablePromise`, which is a
collection of simple query primitives built onto the `Promise` API. The
query model is lazy and LINQ-like, and generally intended to make
`Promise` simpler to deal with in query scenarios. See #2601 for more
details.

Fixes #2600.
2019-06-03 14:56:49 -07:00
Alex Clemmer bcc17c8768 Return errors from query programs through the console 2019-06-03 14:56:49 -07:00
Alex Clemmer df5273e549 Add __pulumiType to CustomResource class
Running `pulumi query` over state resources will require the ability to
filter resources by type.

This commit begins the process of making this possible simply, using the
TypeScript user-defined type guards feature. This commit changes the
`CustomResource` constructor to record the `t` argument in the
`__pulumiType` field, which acts as a "sentinel" value in the resource
base, which deriving classes need only check to ensure they are of that
type. For example:

    aws.s3.Bucket.isInstance(someOb)

would check the `aws.s3.Bucket.__pulumiType` field, and make sure that
the type field lines up.
2019-06-03 14:56:49 -07:00
Sean Gillespie 2870518a64 Refine resource replacement logic for providers (#2767)
This commit touches an intersection of a few different provider-oriented
features that combined to cause a particularly severe bug that made it
impossible for users to upgrade provider versions without seeing
replacements with their resources.

For some context, Pulumi models all providers as resources and places
them in the snapshot like any other resource. Every resource has a
reference to the provider that created it. If a Pulumi program does not
specify a particular provider to use when performing a resource
operation, the Pulumi engine injects one automatically; these are called
"default providers" and are the most common ways that users end up with
providers in their snapshot. Default providers can be identified by
their name, which is always prefixed with "default".

Recently, in an effort to make the Pulumi engine more flexible with
provider versions, it was made possible for the engine to have multiple
default providers active for a provider of a particular type, which was
previously not possible. Because a provider is identified as a tuple of
package name and version, it was difficult to find a name for these
duplicate default providers that did not cause additional problems. The
provider versioning PR gave these default providers a name that was
derived from the version of the package. This proved to be a problem,
because when users upgraded from one version of a package to another,
this changed the name of their default provider which in turn caused all
of their resources created using that provider (read: everything) to be
replaced.

To combat this, this PR introduces a rule that the engine will apply
when diffing a resource to determine whether or not it needs to be
replaced: "If a resource's provider changes, and both old and new
providers are default providers whose properties do not require
replacement, proceed as if there were no diff." This allows the engine
to gracefully recognize and recover when a resource's default provider changes
names, as long as the provider's config has not changed.
2019-06-03 12:16:31 -07:00
Matt Ellis 9c4ee43041
Merge pull request #2789 from pulumi/ellismg/fix-2524
Add `--server` to pulumi plugin install
2019-06-03 09:58:59 -07:00
Matt Ellis 0fbce2c9ce Update CHANGELOG.md 2019-06-03 09:31:50 -07:00
Matt Ellis c201d92380 Use server information from NodeJS host for fetching plugins 2019-06-03 09:31:18 -07:00
Matt Ellis 08d34e8b0f Allow GetRequiredPlugins RPC to return a download location 2019-06-03 09:31:18 -07:00
Matt Ellis 917f3738c5 Add --server to pulumi plugin install
Previously, when the CLI wanted to install a plugin, it used a special
method, `DownloadPlugin` on the `httpstate` backend to actually fetch
the tarball that had the plugin. The reason for this is largely tied
to history, at one point during a closed beta, we required presenting
an API key to download plugins (as a way to enforce folks outside the
beta could not download them) and because of that it was natural to
bake that functionality into the part of the code that interfaced with
the rest of the API from the Pulumi Service.

The downside here is that it means we need to host all the plugins on
`api.pulumi.com` which prevents community folks from being able to
easily write resource providers, since they have to manually manage
the process of downloading a provider to a machine and getting it on
the `$PATH` or putting it in the plugin cache.

To make this easier, we add a `--server` argument you can pass to
`pulumi plugin install` to control the URL that it attempts to fetch
the tarball from. We still have perscriptive guidence on how the
tarball must be
named (`pulumi-[<type>]-[<provider-name>]-vX.Y.Z.tar.gz`) but the base
URL can now be configured.

Folks publishing packages can use install scripts to run `pulumi
plugin install` passing a custom `--server` argument, if needed.

There are two improvements we can make to provide a nicer end to end
story here:

- We can augment the GetRequiredPlugins method on the language
  provider to also return information about an optional server to use
  when downloading the provider.

- We can pass information about a server to download plugins from as
  part of a resource registration or creation of a first class
  provider.

These help out in cases where for one reason or another where `pulumi
plugin install` doesn't get run before an update takes place and would
allow us to either do the right thing ahead of time or provide better
error messages with the correct `--server` argument. But, for now,
this unblocks a majority of the cases we care about and provides a
path forward for folks that want to develop and host their own
resource providers.
2019-06-03 09:31:18 -07:00
Luke Hoban 15e924b5cf
Support aliases for renaming, re-typing, or re-parenting resources (#2774)
Adds a new resource option `aliases` which can be used to rename a resource.  When making a breaking change to the name or type of a resource or component, the old name can be added to the list of `aliases` for a resource to ensure that existing resources will be migrated to the new name instead of being deleted and replaced with the new named resource.

There are two key places this change is implemented. 

The first is the step generator in the engine.  When computing whether there is an old version of a registered resource, we now take into account the aliases specified on the registered resource.  That is, we first look up the resource by its new URN in the old state, and then by any aliases provided (in order).  This can allow the resource to be matched as a (potential) update to an existing resource with a different URN.

The second is the core `Resource` constructor in the JavaScript (and soon Python) SDKs.  This change ensures that when a parent resource is aliased, that all children implicitly inherit corresponding aliases.  It is similar to how many other resource options are "inherited" implicitly from the parent.

Four specific scenarios are explicitly tested as part of this PR:
1. Renaming a resource
2. Adopting a resource into a component (as the owner of both component and consumption codebases)
3. Renaming a component instance (as the owner of the consumption codebase without changes to the component)
4. Changing the type of a component (as the owner of the component codebase without changes to the consumption codebase)
4. Combining (1) and (3) to make both changes to a resource at the same time
2019-05-31 23:01:01 -07:00
Matt Ellis cb6ccb8026 Fix repository section of package.json
See https://docs.npmjs.com/files/package.json#repository for guidence
from NPM on how to do this.
2019-05-31 17:52:53 -07:00
Matt Ellis 9a77d72403 Set Outputs for providers in the state file. (#2793)
We model providers as resources in our state file, but we were
neglecting to set Outputs for these resources.  This was problematic
when we started to try to run DiffConfig, because when diffing a
resource we compare thed new inputs and the old outputs, but the
resource never had any old outputs, so it was impossible for the
provider to see what the old state of the resource was.

To fix this, we now reflect the inputs we use the create the provider
reference as outputs on the resource.
2019-05-31 15:14:42 -07:00
Pat Gavlin 6756c7ccec
Use new.{URN,Type,Provider} in applicable Steps. (#2787)
Just what it says on the tin. These changes are in support of the
aliasing work in #2774.
2019-05-30 17:48:00 -07:00
Praneet Loke 5ac446fffd
Add CI vars for Bitbucket Pipelines (#2783)
* Introduce a new package under ciutil for individual CI systems. Split-out each CI system with env var detection for each.

* Add Bitbucket Piplines env var detection.

* Update changelog with note about adding Bitbucket Pipelines detection.

* Rename the CI system structs.

* Move files from ciutil/systems to ciutil. Un-export some types that don't need visibility beyond the ciutil package.

* Un-export DetectSystem function and the System type.

* Add a test for CI systems which we only know by name and nothing else, i.e. those with just a baseCI implementation.
2019-05-30 17:35:41 -07:00
Pat Gavlin 2324eaaa59
Add StackReference to the Python SDK (#2786)
This commit adds StackReference to the Python SDK, which uses
read_resource to read the remote state of a a Pulumi stack.
2019-05-30 14:12:37 -07:00
Sean Gillespie eda5de0f88 Implementation of Read for Python (#2752)
This commit implements read_resource functionality for Python in a
manner identical to the NodeJS implementation. If an "id" option is
passed to a resource via ResourceOptions on construction, that resource
will be read and not created.
2019-05-30 11:04:47 -07:00
Matt Ellis 00bf458e39
Merge pull request #2766 from pulumi/ellismg/diff-check-config
Implement DiffConfig/CheckConfig for plugin based providers
2019-05-30 10:36:02 -07:00
Matt Ellis e8487ad87f Workaround a bug in the kubernetes provider
The Kubernetes provider wanted to return Unimplemented for both
DiffConfig and CheckConfig. However, due to an interaction between the
package we used to construct the error we are returning and the
package we are using to actually construct the gRPC server for the
provider, we ended up in a place where the provider would actually end
up returning an error with code "Unknown", and the /text/ of the
message included information about it being due to the RPC not being
implemented.

So, when we try to call Diff/Check config on the provider, detect this
case as well and treat messages of this shape as if the provider just
returned "Unimplemented".
2019-05-29 11:53:10 -07:00
Praneet Loke bf3325d9c3
Remove the GitHubLogin and GitHubRepo update metadata keys (#2732) 2019-05-29 11:22:59 -07:00
Justin Van Patten 5df2b15320
Update CHANGELOG.md (#2778) 2019-05-28 17:31:41 -07:00
CyrusNajmabadi b84b3d487d
Revert "Simplify signature of pulumi.all (#2527)" (#2775)
This reverts commit b32892e0c1.
2019-05-28 10:54:56 -07:00
Joe Duffy bf75fe0662
Suppress JSON outputs in preview correctly (#2771)
If --suppress-outputs is passed to `pulumi preview --json`, we
should not emit the stack outputs. This change fixes pulumi/pulumi#2765.

Also adds a test case for this plus some variants of updates.
2019-05-25 12:10:38 +02:00
Matt Ellis 0574d8cd6f Attempt to download plugins before doing a refresh
Like `preview`, `update` and `destroy` we should ensure any plugins
that are listed in the snapshot are present.

Fixes #2669
2019-05-24 16:12:22 -07:00
Matt Ellis 261f012223 Correctly handle CheckConfig/DiffConfig and dynamic provider
In 3621c01f4b, we implemented
CheckConfig/DiffConfig incorrectly. We should have explicilty added
the handlers (to supress the warnings we were getting) but returned an
error saying the RPC was not implemented.  Instead, we just returned
success but passed back bogus data.  This was "fine" at the time
because nothing called these methods.

Now that we are actually calling them, returning incorrect values
leads to errors in grpc. To deal with this we do two things:

1. Adjust the implementations in the dynamic provider to correctly
return not implemented. This allows us to pick up the default engine
behavior going forward.

2. Add some code in CheckConfig/DiffConfig that handle the gRPC error
that is returned when calling methods on the dynamic provider and fall
back to the legacy behavior. This means updating your CLI will not
cause issues for existing resources where the SDK has not been
updated.
2019-05-23 13:34:47 -07:00
Matt Ellis 8397ae447f Implement DiffConfig/CheckConfig for plugins 2019-05-23 13:34:34 -07:00
Dominik-K a80d29c897 NodeJS: add semver as dependency (imported in runtime/closure/v8Hooks.js) (#2763) 2019-05-23 12:26:47 -06:00
Matt Ellis f897bf8b4b Flow allowUnknows for Diff/Check Config
We pass this information for Diff and Check on specific resources, so
we can correctly block unknows from flowing to plugins during applies.
2019-05-23 10:54:18 -07:00
Matt Ellis e574f33fa0 Include URN as an argument in DiffConfig/CheckConfig
For provider plugins, the gRPC interfaces expect that a URN would be
included as part of the DiffConfig/CheckConfig request, which means we
need to flow this value into our Provider interface.

This change does that.
2019-05-23 10:43:22 -07:00
Justin Van Patten da7c8f1dde
Improvements to the gen-markdown command for Hugo (#2764)
Updates to the gen-markdown command for the Hugo migration.
2019-05-23 10:37:10 -07:00
James Nugent 26fc9af630
Merge pull request #2760 from pulumi/stack72/fixup-pulumi-whoami-release-date
cmd/whoami: Move the changelog entry to unreleased
2019-05-23 13:41:11 +02:00
stack72 19bf51d89a cmd/whoami: Move the changelog entry to unreleased
This was originally part of an older release but it has since been
moved to unreleased as it was only recently merged
2019-05-23 12:37:19 +02:00
Chris Smith 6577784114
Reduce overhead of emitting engine events (#2735)
* Reduce size of most common apitype EngineEvents

* Update endpoint names for trace logging
2019-05-22 12:22:40 -07:00
Paul Stack fa691d8c40
cli/whoami: Addition of the currently connected backend to whoami (#2686)
cli/whoami: Addition of the currently connected backend to whoami
2019-05-22 15:57:52 +03:00