Commit graph

256 commits

Author SHA1 Message Date
Pat Gavlin 76a0079641
Fix two colorization issues. (#3385)
- The length of the text content (i.e. the content of a colorized string
  that is not control sequences) was not being correctly tracked. This
  caused the "status" column of the progress display to overflow.
- Colorization was unconditionally disabled on Windows. When we were
  using loreley, we had set the global colorization flag s.t.
  colorization on Windows _should_ have been disabled, but we overrode
  this flag each time we actually colorized anything.

Fixes #3378.
2019-10-21 16:05:45 -07:00
Ryan Campbell 665b4caa89 Update python FileAsset to accept os.PathLike in addition to str. (#3368)
This should fix #2896.
2019-10-18 14:31:59 -07:00
Pat Gavlin fa20d88e12 Update the CHANGELOG for 1.3.4 2019-10-18 13:47:35 -07:00
Pat Gavlin 1ae6629d81 Prepare the CHANGELOG for v1.3.3 2019-10-17 15:10:30 -07:00
CyrusNajmabadi 8272a48447
Update changelist. 2019-10-16 11:58:11 -07:00
CyrusNajmabadi 91addf2feb
New approach to move us to using deasync as little as possible (and with as little impact to users as possible). (#3325) 2019-10-14 22:08:06 -07:00
Luke Hoban 893e51d0ce
Add Python resource transformations support (#3319)
Adds Python support for resource transformations aligned with the existing NodeJS support in #3174.

This PR also moves processing of transformations to earlier in the resource construction process (for both NodeJS and Python) to ensure that invariants established in the constructor cannot be violated by transformations. This change can technically be a breaking change, but given that (a) the transformations features was just released in 1.3.0 and (b) the cases where this is a breaking change are uncommon and unlikely to have been reliable anyway - it feels like a change we should make now.

Fixes #3283.
2019-10-14 19:35:00 -05:00
Pat Gavlin 97803a6591 Prepare the CHANGELOG for 1.3.1. 2019-10-10 10:33:50 -07:00
Pat Gavlin 834e583c95
Revert "Propagate inputs to outputs during preview. (#3245)" (#3324)
This reverts commit 80504bf0bc.
2019-10-10 10:33:05 -07:00
Pat Gavlin 7778d7ae84 Prepare the CHANGELOG for 1.3.0. 2019-10-09 11:50:21 -07:00
Mikhail Shilkov 69743fe2bf Make the path to .pulumi folder configurable with an ENV variable (#3300)
Introduces `PULUMI_HOME` environment variable which points to a path to the path to `.pulumi` folder. Defaults to `<user's home dir> + ".pulumi"` if not specified.

Fixes #2966. In addition to plugins, it "moves" the credentials file, templates, workspaces.

`bin` folder is intact: to move it, we need to adjust all installation scripts to respect `PULUMI_HOME` and put executables in the proper `bin` folder.
2019-10-08 15:01:46 -07:00
Pat Gavlin 22799879e8 Fix the CHANGELOG. 2019-10-08 14:50:00 -07:00
Chris Smith 97d769000d
Support renaming stack projects (#3292)
* Support renaming stack projects

* Update CHANGELOG.md

* Address PR feedback
2019-10-03 09:13:13 -07:00
Pat Gavlin ecd028104c
Fetch CLI verisons from Homebrew where applicable. (#3290)
If the CLI seems to have been installed using Homebrew, do not consult
the service for the latest version. Instead, consult the Homebrew JSON
API.

Fixes #3230.
2019-10-01 13:34:42 -07:00
CyrusNajmabadi 52884096e9
Add support for updating a subset of resources in the stack (i.e. --target) (#3251) 2019-09-30 23:41:56 -07:00
Pat Gavlin 80504bf0bc
Propagate inputs to outputs during preview. (#3245)
These changes restore a more-correct version of the behavior that was
disabled with #3014. The original implementation of this behavior was
done in the SDKs, which do not have access to the complete inputs for a
resource (in particular, default values filled in by the provider during
`Check` are not exposed to the SDK). This lack of information meant that
the resolved output values could disagree with the typings present in
a provider SDK. Exacerbating this problem was the fact that unknown
values were dropped entirely, causing `undefined` values to appear in
unexpected places.

By doing this in the engine and allowing unknown values to be
represented in a first-class manner in the SDK, we can attack both of
these issues.

Although this behavior is not _strictly_ consistent with respect to the
resource model--in an update, a resource's output properties will come
from its provider and may differ from its input properties--this
behavior was present in the product for a fairly long time without
significant issues. In the future, we may be able to improve the
accuracy of resource outputs during a preview by allowing the provider
to dry-run CRUD operations and return partially-known values where
possible.

These changes also introduce new APIs in the Node and Python SDKs
that work with unknown values in a first-class fashion:
- A new parameter to the `apply` function that indicates that the
  callback should be run even if the result of the apply contains
  unknown values
- `containsUnknowns` and `isUnknown`, which return true if a value
  either contains nested unknown values or is exactly an unknown value
- The `Unknown` type, which represents unknown values

The primary use case for these APIs is to allow nested, properties with
known values to be accessed via the lifted property accessor even when
the containing property is not fully know. A common example of this
pattern is the `metadata.name` property of a Kubernetes `Namespace`
object: while other properties of the `metadata` bag may be unknown,
`name` is often known. These APIs allow `ns.metadata.name` to return a
known value in this case.

In order to avoid exposing downlevel SDKs to unknown values--a change
which could break user code by exposing it to unexpected values--a
language SDK must indicate whether or not it supports first-class
unknown values as part of each `RegisterResourceRequest`.

These changes also allow us to avoid breaking user code with the new
behavior introduced by the prior commit.

Fixes #3190.
2019-09-30 11:03:58 -07:00
Luke Hoban 9374c374c3
Transformations (#3174)
Adds the ability to provide `transformations` to modify the properties and resource options that will be used for any child resource of a component or stack.

This offers an "escape hatch" to modify the behaviour of a component by peeking behind it's abstraction.  For example, it can be used to add a resource option (`additionalSecretOutputs`, `aliases`, `protect`, etc.) to a specific known child of a component, or to modify some input property to a child resource if the component does not (yet) expose the ability to control that input directly.  It could also be used for more interesting scenarios - such as:
1. Automatically applying tags to all resources that support them in a stack (or component)
2. Injecting real dependencies between stringly-referenced  resources in a Helm Chart 
3. Injecting explicit names using a preferred naming convention across all resources in a stack
4. Injecting `import` onto all resources by doing a lookup into a name=>id mapping

Because this feature makes it possible to peek behind a component abstraction, it must be used with care in cases where the component is versioned independently of the use of transformations.  Also, this can result in "spooky action at a distance", so should be used judiciously.  That said - this can be used as an escape hatch to unblock a wide variety of common use cases without waiting on changes to be made in a component implementation.  

Each transformation is passed the `resource`, `name`, `type`, `props` and `opts` that are passed into the `Resource` constructor for any resource descended from the resource that has the transformation applied.  The transformation callback can optionally return alternate versions of the `props` and `opts` to be used in place of the original values provided to the resource constructor.

Fixes #2068.
2019-09-29 11:27:37 -07:00
Pat Gavlin dd8155ae20 Prepare the CHANGELOG for 1.2.0 2019-09-26 13:27:57 -07:00
Praneet Loke a0a86155c1
Add the config array option to the preview command. (#3271)
* Add the config array option to the preview command.

* Update changelog
2019-09-25 17:45:36 -07:00
Praneet Loke 4404dfb470
Add codefresh CI detection. Thanks to @fernandocarletti. (#3270)
* Add codefresh CI detection. Thanks to @fernandocarletti.
2019-09-25 14:41:13 -07:00
CyrusNajmabadi c1ff9c37f8
Delete specific target (#3244) 2019-09-19 19:28:14 -07:00
Pat Gavlin 40b0f8cbab
Cache ciphertext for secret properties. (#3183)
This caching is enabled by wrapping the `secrets.Manager` returned by
`DefaultSecretsProvider.OfType` in an outer `secrets.Manager` that
cooperates with `stack.{Serialize,Deserialize}PropertyValue`. Ciphertext
is cached on a per-secret-instance basis (i.e. not a per-plaintext-value
basis). Cached ciphertext is only reused if the plaintext for the secret
value has not changed. Entries are inserted into the cache upon both
encryption and decryption so that values that originated from ciphertext
and that have not changed can aoid re-encryption.

Contributes to #3178.
2019-09-18 15:52:31 -07:00
CyrusNajmabadi f788eb8fc1
Add support for refreshing specific targets. (#3225) 2019-09-17 18:14:10 -07:00
Erin Krengel 938c2e8bd8
Fix parsing of Gitlab urls w subgroups (#3239) 2019-09-16 20:35:23 -07:00
Pat Gavlin 82204230e1
Improve tracing support. (#3238)
* Fix some tracing issues.

- Add endpoints for `startUpdate` and `postEngineEventsBatch` so that
  spans for these invocations have proper names
- Inject a tracing span when walking a plan so that resource operations
  are properly parented
- When handling gRPC calls, inject a tracing span into the call's
  metadata if no span is already present so that resource monitor and
  engine spans are properly parented
- Do not trace client gRPC invocations of the empty method so that these
  calls (which are used to determine server availability) do not muddy
  the trace. Note that I tried parenting these spans appropriately, but
  doing so broke the trace entirely.

With these changes, the only unparented span in a typical Pulumi
invocation is a single call to `getUser`. This span is unparented
because that call does not have a context available. Plumbing a context
into that particular call is surprisingly tricky, as it is often called
by other context-less functions.

* Make tracing support more flexible.

- Add support for writing trace data to a local file using Appdash
- Add support for viewing Appdash traces via the CLI
2019-09-16 14:16:43 -07:00
Pat Gavlin 5af13f9a4f Prepare the CHANGELOG for v1.1.0 2019-09-11 13:56:48 -07:00
Mikhail Shilkov 6ac21fc430 Fix the pulumi new --stack option (#3131)
* Fix the pulumi new --stack option

* Changelog

* Restore the existing stack check with an added guard
2019-09-11 18:40:04 +02:00
CyrusNajmabadi e61f8fdcb8
Update us to the same target ES version that Nodejs uses. (#3213) 2019-09-10 16:19:12 -07:00
Mikhail Shilkov 7b3a7c6253 Do not ask for a passphrase in non-interactive sessions (#3204)
* Do not ask for a passphrase in non-interactive sessions. Fail with a hint to set the environment variable.

* Changelog
2019-09-10 13:25:57 -07:00
Luke Hoban d3475c02b8
Merge pull request #3198 from pulumi/lukehoban/cloudsecretsfilestatebackend
Adds test coverage for cloud-backed secrets combined with filestate backend. This combination (for example, S3 + KMS) is likely to be common.

Fixes #3189.
2019-09-09 15:09:40 -07:00
Paul Stack 8d1b725840
GH-2319: Increase the grpc.MaxCallRecvMsgSize (#3201)
Fixes: #2319

In #2319, a user is hitting the gRPC limit on the message size the
server can receive when uploading ec2 user-data

This commit doubles the limit that can be sent from `1024*1024*4` to
`1024*1024*8`
2019-09-09 21:31:54 +03:00
Pat Gavlin 38876d64f0
Ignore reads in HasChanges. (#3197)
This matches the behavior of the display logic, which does not consider
reads to be changes. This also matches the expectation of tests that
pass `--expect-no-changes` (and likely user intuition).
2019-09-06 22:10:34 -07:00
Luke Hoban ad287b844b Add CHANGELOG 2019-09-06 17:19:31 -07:00
Pat Gavlin 48c8ea1e8a
Do not drop unhandled exceptions in Python (#3170)
- Do not use a non-zero-to-zero transition in the number of outstanding
  RPCs to determine the completion of a Python program until after the
  synchronous piece of the program has finished running is complete
- Instead of using a future to indicate that either a) a zero-to-one
  transition in the number of outstanding RPCs has occurred, or b) an
  unhandled exception has occurred, a) observe the transition itself,
  and b) use an optional exception field to track the presence or
  absence of an exception.

Fixes #3162.
2019-09-06 13:53:07 -07:00
Pat Gavlin 6ea8b3b3dd
Update CHANGELOG for 1.0.0 (#3177) 2019-09-03 15:28:51 -07:00
Matt Ellis 809c91c004 Update CHANGELOG for 1.0.0-rc.1 2019-08-28 13:54:57 -07:00
Luke Hoban f0a24079ce
Filter the list of templates shown by default (#3147)
If any templates are marked as `Important: true` then by default show only those templates along with an option to see additional templates.

Fixes #3094.
2019-08-27 17:56:49 -07:00
Luke Hoban 47dc3cfb8b
Print a Welcome to Pulumi message (#3145)
Present a warm welcome to users when they interactively login.

Also use this as an opportunity to present a "Tip of the Day" - which for now we will use to highlight auto-naming as this has been a common new user question.
2019-08-27 17:19:35 -07:00
Alex Clemmer 99d70e4610 Introduce MarshalOptions.{RejectAsset, RejectArchive}
Not all resource providers support Pulumi's Asset and Archive types. In
particular, the Kubernetes provider should reject any resource
definition that contains either of these types.

This commit will introduce two MarshalOptions that will make it easy for
the Kubernetes provider to guarantee that no properties of this type are
in a resource request, as it's deserializing the request from the
engine.
2019-08-26 15:19:14 -07:00
Mikhail Shilkov c270204387 Check project existence during pulumi new 2019-08-23 09:09:54 +02:00
Chris Smith eb0934970c
Add support for filtering stacks by organization, tag (#3108)
* Add support for filtering stacks by organization, tag

* Update CHANGELOG.md

* Address PR feedback

* Address even more PR feedback

* Support empty-string filters
2019-08-22 13:56:43 -07:00
Matt Ellis e349f3c094 Fix stack reference issue when running on a pre -beta.3 CLI
In #3071 we made change to the built in provider for `StackReference`
to return additional data about the names of outputs which were
secrets.  The SDKs uses this information to decide if it should mark a
stack output as secret when returning it's value from `getOutput`.

When using an older CLI which does not report this data, we hit an
error:

```
 TypeError: Cannot read property 'outputs' of undefined
```

This was caused by a refactoring error where we extracted a private
helper out of the StackReference class, but neglected to change one
instance of `this` to `sr`. While we do have tests that exercise this
feature, we would only see this bug when using an older CLI, and we
don't have automated tests here that use the neweset `@pulumi/pulumi`
with an older `pulumi` CLI
2019-08-22 11:55:02 -07:00
Matt Ellis 7696ed8e94 Prepare for 1.0.0-beta.3 release 2019-08-21 10:33:33 -07:00
Pat Gavlin 42fc75fffe
Fail read steps with missing resources. (#3123)
Just what it says on the tin.

Fixes #262.
2019-08-21 10:09:02 -07:00
Pat Gavlin 8745440c1b
Allow users to explicitly disable delete-before-replace. (#3118)
With these changes, a user may explicitly set `deleteBeforeReplace` to
`false` in order to disable DBR behavior for a particular resource. This
is the SDK + CLI escape hatch for cases where the changes in
https://github.com/pulumi/pulumi-terraform/pull/465 cause undesirable
behavior.
2019-08-20 15:51:02 -07:00
Matt Ellis 900046a6ed
Merge pull request #3089 from pulumi/ellismg/fix-2714
Fix issues in the filestate backend
2019-08-19 10:50:44 -07:00
Mikhail Shilkov 7f672a1c50 Changelog 2019-08-19 08:28:34 +02:00
Matt Ellis 828086d638 Do not attempt to load checkpoint before saving a snapshot
For historical reasons, we used to need to require to load an existing
checkpoint to copy some data from it into the snapshot when saving a
new snapshot. The need for this was removed as part of the general
work in #2678, but we continued to load the checkpoint and then just
disregard the data that was returned (unless there was an error and
that error was not FileNotFound, in which case we would fail).

Our logic for checking if something was FileNotFound was correct when
we wrote it, but when we adopted go-cloud in order to have our
filestate backend also write to blob storage backends like S3, we
forgot that we had checks like `os.IsNotExists()` floating around
which were now incorrect. That meant if the file did not exist for
some reason, instead of going along as planned, we'd error out now
with an error saying something wasn't found.

When we write a checkpoint, we first "backed up" the initial version
by renaming it to include a `.bak` suffix, then we write the new file
in place. However, this can run afoul of eventual consistency models
like S3, since there will be a period of time in which a caller may
observe that the object is missing, even after a new version is
written (based on my understanding of [S3's consistency
model](https://docs.aws.amazon.com/AmazonS3/latest/dev/Introduction.html#ConsistencyModel)

Since we no longer need to actually copy any information from the
previous checkpoint, we can simply remove the call entirely to load
it.

As a follow up, we need to audit places inside the filebased backend
that assume `os.*` functions are going to do what we want them to do,
since in general they will not.

Fixes #2714
2019-08-16 13:40:55 -07:00
Matt Ellis 342f8311a1 Fix renaming a freshly created stack using the local backend
Attempting to `pulumi stack rename` a stack which had been created but
never updated, when using the local backend, was broken because
code-paths were not hardened against the snapshot being `nil` (which
is the case for a stack before the initial deployment had been done).

Fixes #2654
2019-08-16 13:39:34 -07:00
Paul Stack f8db8e4209
Allow resource IDs to change on reresh steps (#3087)
* Allow resource IDs to change on reresh steps

This is a requirement for us to be able to move forward with
versions of the Terraform Azurerm provider. In v1.32.1, there was
a state migration that changed the ID format of the azure table
storage resource

We used to have a check in place for old ID being equal to new ID.
This has been changed now and we allow the change of ID to happen
in the RefreshStep

* Update pkg/resource/deploy/step.go

Co-Authored-By: Pat Gavlin <pat@pulumi.com>
2019-08-16 21:04:03 +03:00