Commit graph

2518 commits

Author SHA1 Message Date
Evan Boyle 94cd67b564
[Go Program Gen] Improved type handling and invokes (#4749) 2020-06-05 18:52:00 -07:00
Levi Blackstone 7254779b28
[codegen/nodejs] Fix k8s index.ts generation (#4756) 2020-06-05 16:41:07 -06:00
Levi Blackstone 875c4dab89
[codegen/nodejs] Fix remaining issues with k8s codegen (#4325) 2020-06-05 11:11:18 -06:00
Pat Gavlin e6fb3ef0f8
[codegen/nodejs/sdk] Fix token type config getter. (#4753)
If the type of a configuration variable is a token type (i.e. a type
provided by an overlay) with the underlying type string, call
`config.get` rather than `config.getObject`. This fixes a regression in
the `aws.config.region` variable.
2020-06-04 14:51:21 -07:00
Paul Stack 58002bae62
Ensuring a property level deprecation warning is set for python codegen (#4744) 2020-06-04 11:29:23 +01:00
Levi Blackstone 8a7e10d37a
[codegen/nodejs] Refactor GeneratePackage method (#4737)
- Split out common functionality into generateModuleContextMap method
- Add LanguageResource and LanguageProperty structs for use by downstream
codegen tools
- Add LanguageResources function for use by downstream codegen tools
2020-06-03 19:20:32 -06:00
Pat Gavlin bd1c0e6d7b
[codegen/schema] Support default union types. (#4746)
Add support for union types that indicate a default type for targets
that do not support unions, or do not support unions in certain
positions (e.g. output properties). The NodeJS backend makes use of this
in combination with a new flag, `disableUnionOutputTypes`, to avoid
generating unions in output types.

These changes also refactor the various module ->
package/module/namespace mapping methods so that these entities can be
fetched by their language name rather than their token.
2020-06-02 18:15:21 -07:00
Pat Gavlin d77cda98fc
[codegen/hcl2] Fixes for RewriteConversions. (#4743)
- Typecheck in all cases where a type may have changed
- Do not perform literal conversions if the type is already correct
- Perform literal conversions before checking to see if a call to
  `__convert` is required. This catches cases such as string literals
  passed where ints are required. Without this change, that form in
  particular generates a bare number literal rather than a number
  literal wrapped in a `__convert`.
2020-06-02 12:00:35 -07:00
Lee Briggs bc05e2c955
improve dev version detection (#4732)
Co-authored-by: Justin Van Patten <jvp@justinvp.com>
2020-06-02 11:51:04 +01:00
Pat Gavlin 962fe01734
[codegen/nodejs/sdk] Do not write reserved files. (#4742)
If the source file for a resource or function definition would collide
with a reserved filename (e.g. `index.ts`), append an underscore to its
filename (e.g. `index_.ts`).
2020-06-01 16:24:21 -07:00
Pat Gavlin 726d43a5bd
[codegen/nodejs/sdk] Split required {in,out}puts. (#4736)
These changes are necessary in order to move tfgen over to the schema
code generator.

The schema generator for tfgen has an annoying behavior for nested types
in which it does not separate input and output types. Worse, the shape
of the type that results from a collision of input and output types is
order-dependent: whichever of the two was observed last wins (note that
the shape is still determenistic, as the order in which types are
recorded is always the same). As a result, the NodeJS code generator
needs to know the set of required properties for the other aspect of the
type in order to generate proper code.

Contributes to
https://github.com/pulumi/pulumi-terraform-bridge/issues/179.
2020-06-01 11:50:10 -07:00
Levi Blackstone 9b980c14f2
Address NodeJS codegen feedback (#4734)
Follow up on feedback for https://github.com/pulumi/pulumi/pull/4730
2020-05-29 16:35:42 -06:00
Levi Blackstone 3fd51da719
Add k8s compatibility mode for NodeJS codegen (#4730) 2020-05-29 13:39:29 -06:00
Levi Blackstone d0388e5525
Only generate top-level README in NodeJS packages (#4729) 2020-05-29 13:36:16 -06:00
Lee Zen 4ff083639a
Clarify backend login help text (#4726) 2020-05-29 10:10:12 -07:00
Mikhail Shilkov cf8b6c1237
Convert primitive types in C# program gen (#4686) 2020-05-29 12:38:53 +02:00
Pat Gavlin 75c3ccf53d
[codegen/nodejs/sdk] Minor fixes. (#4725)
- Only wrap field types in `pulumi.Input<>` in types that are part of
  the input SDK.
- Ensure that READMEs have a trailing newline.

Contributes to https://github.com/pulumi/pulumi-terraform-bridge/issues/179.
2020-05-28 16:24:48 -07:00
Levi Blackstone a8486520a3
Update NodeJS codegen to use codegen.StringSet (#4724) 2020-05-28 17:22:50 -06:00
Levi Blackstone 754a4ae51d
Fix NodeJS codegen to handle recursive types (#4723)
Track the input/output types that have been encountered
and don't recurse into previously seen types.
2020-05-28 16:37:39 -06:00
Evan Boyle 9b2c6d726d
[Go Program Gen] binary, unary, and conditional expression support (#4716) 2020-05-28 13:47:49 -07:00
Paul Stack 45e1917a30
Upgrade to Go 1.14.x (#4697) 2020-05-28 12:01:33 +01:00
Komal e2ba2a067c
Fix typo in nodejs importer (#4711) 2020-05-27 08:58:27 -07:00
Evan Boyle c8142677cc
expression tests for basic go program literals (#4709) 2020-05-27 07:32:13 -07:00
Mikhail Shilkov b6f61b45ad
Don't mark provider token string types with json attribute in C# (#4658)
Don't mark provider token string types with json attribute in C#
2020-05-27 10:14:38 +02:00
Mikhail Shilkov c66192130a
Small bug fixes in C# codegen (#4702) 2020-05-26 19:12:56 +02:00
Pat Gavlin e973ec0491
[codegen/hcl2] Fix assignability from dynamic. (#4704)
Types like output(T), promise(T), and union(T_0, ..., T_N) should be
assignable from dynamic if they contain an element type that is
assignable from dynamic.

This allows consumers to use the following code to check if some type
behaves like the dynamic type w.r.t. conversions:

```
if t.AssignableFrom(model.DynamicType) {
}
```

Fixes #4703.
2020-05-26 09:05:42 -07:00
Pat Gavlin cb8066d74a
[codegen/hcl2] Fix ForExpression.Evaluate. (#4701)
This expression was not evaluated correctly when producing a dictionary.
2020-05-26 09:05:35 -07:00
Pat Gavlin 05032d6850 [codegen/hcl2] Fix assignability from dynamic.
Types like output(T), promise(T), and union(T_0, ..., T_N) should be
assignable from dynamic if they contain an element type that is
assignable from dynamic.

This allows consumers to use the following code to check if some type
behaves like the dynamic type w.r.t. conversions:

```
if t.AssignableFrom(model.DynamicType) {
}
```

Fixes #4703.
2020-05-26 08:21:09 -07:00
Evan Boyle ea114b04ee
output generation for s3 logging example (#4681) 2020-05-26 07:07:54 -07:00
Chris Smith f613b6917b
Download plugins from get.pulumi.com (#4692)
* Remove long-since deprecated --cloud-url flag

* Download plugins from get.pulumi.com

* Update CHANGELOG.md

* Use more straight forward TrimSuffix
2020-05-25 09:16:57 -07:00
Justin Van Patten 6b0a845cc1
Support publishing Python policy packs (#4644)
Adds support for publishing Python policy packs to the service, and downloading/using such policy packs when applied to stacks in an organization.
2020-05-22 15:01:15 -07:00
Sean Holung c538db64c8
Anchoring properties (#4488) 2020-05-22 14:53:34 -07:00
Pat Gavlin 5330c97684
[codegen/hcl2/model] Remove type caches. (#4683) 2020-05-22 10:47:34 +01:00
Mikhail Shilkov 7e3b60b3d1
Fix C# (and a bit of Node.js) program gen based on errors from AWS samples (#4673) 2020-05-22 08:46:25 +02:00
Lee Zen 8bc3d0e906
Fix single-quote examples in command help (#4680) 2020-05-21 14:27:30 -07:00
Evan Boyle 8dd329f57f
Go basic program gen (#4667) 2020-05-21 10:23:33 -07:00
Lee Briggs afb9456aa8
Remove replace for gocloud.dev 2020-05-19 08:09:58 -07:00
Lee Briggs 362fc8d7f2
Merge branch 'master' into feature/go-cloud-azurekeyvault-regions 2020-05-19 08:07:09 -07:00
Mikhail Shilkov adfa8116fb
Introduce k8s compatibility mode to C# codegen (#4544)
Introduce k8s compatibility mode to C# codegen
2020-05-19 11:41:06 +02:00
Dan Hernandez a46731f36c
Include case when attempting to escape the . in a name. (#4513) 2020-05-19 10:11:58 +01:00
Mikhail Shilkov f66100ce28
Initial support for C# program gen (#4611)
Initial support for C# program gen
2020-05-19 10:18:38 +02:00
Pat Gavlin 088751a4a8
[codegen/hcl2] Refactor package schema loading. (#4661)
- Move the implementation of loadPackageSchema into a method on
  PackageCache
- Protect the cache with synchronization primitives to enable
  concurrency in downstream consumers
- Use jsoniter to deserialize schemas
2020-05-18 17:35:11 -07:00
Lee Briggs 72766fd4e6
Use latest upstream of gocloud.dev 2020-05-18 07:43:41 -07:00
Lee Briggs e045c2ac71
# This is a combination of 2 commits.
# This is the 1st commit message:

Use patched azure gocloud library

Fixes #4642

# The commit message #2 will be skipped:

# sync with pulumi-master branch
2020-05-18 07:43:20 -07:00
Praneet Loke 30b12cff49
[codegen/docs] Various Go-related fixes (#4646)
* Remove code that was hiding Go as a language option for k8s overlay resources. Mark input args type for Functions as optional in Go.

* Show a special note in the Go function's snippet when the function name does not match other languages.

* Make sure the draft PR stays assigned to the original author. Add some more comments.

* Remove logic to use the Go ModuleToPackage map to then lookup the relevant C# namespace. Make getLanguageModuleName a method of modContext since passing in a package is not needed anymore.
2020-05-15 17:33:56 -07:00
Mikhail Shilkov 5b410ec440
Resolve referenced packages for every TF program (#4636) 2020-05-15 19:18:07 +02:00
Sean Holung f5ed6190ba
Link Python and Go constructors (#4593) 2020-05-15 09:51:24 -07:00
Pat Gavlin e9dd0e5e69
[codegen/schema] Path unescape type tokens in refs (#4641)
Some type tokens contain characters that are not valid in a single
URL path element (`/` in particular). These type tokens may be
path-escaped, and should be unescaped before they are interpreted.
2020-05-14 13:35:57 -07:00
Evan Boyle 0d257bb32d
go gen_program shell + test + sample (#4630) 2020-05-14 08:43:12 -07:00
Pat Gavlin 8f0a002a26
Generate deprecation comments in Go. (#4631)
This is consistent with the convention for marking members as
deprecated: https://github.com/golang/go/wiki/Deprecated.
2020-05-13 17:12:59 -07:00
Pat Gavlin 99852bc18e
[codegen/nodejs] SDK generator fixes. (#4618)
- Add support for constant values in unions (e.g. `"foo" | "bar"`)
- Generate `Input<T | U>` instead of `Input<T> | Input<U>`
- Emit deprecation messages for resources
- Handle nil state inputs
- Allow packages to provide a README
- Remove sync invoke support

These changes are part of
https://github.com/pulumi/pulumi-terraform-bridge/issues/179, and
restore functional parity with the current `tfgen` generator.
2020-05-13 10:55:37 -07:00
Praneet Loke 54f5a0ac36
[codegen/docs] Use the C# namespaces override map for links. (#4616) 2020-05-13 09:32:40 -07:00
Pat Gavlin 647b6627a2
[codegen/hcl2] Fix descent in RewriteConversions. (#4614)
Descend into anonymous function expressions, the operands to conditional
expressions, and the value in for expressions.
2020-05-13 08:25:26 -07:00
Chris Smith 71910a1c52
Add PULUMI_SKIP_CONFIRMATIONS env var (#4477) 2020-05-13 14:01:02 +01:00
Praneet Loke fcac4af8ae
[codegen/docs] Generate a table with links to the language-specific module pages (#4597)
* Generate language package details in the index pages.

* Add a new DocLanguageHelper interface method to get to a module per-language. 

* Add a new workflow file for automatically creating draft docs PRs for previewing resource docs for AWS and Kubernetes as a result of changes in the resource docs generator.
2020-05-12 15:37:37 -07:00
Pat Gavlin 33258326e0
[codegen/hcl2] Add a conversion insertion pass. (#4594)
Add a rewriter that reifies implicit conversions into a call to the
`__convert` intrinsic. Code generators can recognize this intrinsic and
use it to generate appropriate conversion code.

Part of this work involves redesigning the type annotations system.
Annotations are now only applicable to opaque and object types. Instead
of inspecting annotations directly, code generators should use
`hcl2.GetSchemaForType` to extract the `schema.Type` for a `model.Type`.
2020-05-11 11:17:36 -07:00
Paul Stack 48f906e026
Allow pulumi stack export to decrypt secrets (#4046) 2020-05-11 19:16:30 +01:00
Pat Gavlin 255620ea1e
[codegen/nodejs] Await invokes in async contexts. (#4598)
If we are generating code into an async context (e.g. an async main),
await calls to invoke rather than leaving them as promises. This results
in more idiomatic code withing such contexts.
2020-05-11 10:21:56 -07:00
Paul Stack d9e01da0aa
Merge pull request #4586 from pulumi/stack72/gh-4585
Ensure Go build is an optional step in integration testing framework
2020-05-09 01:29:28 +01:00
Praneet Loke aa313aecf8
[codegen/docs] Add a new template for examples section (#4591)
* Add a new template for examples section. Extract the examples section into a structured format for custom template processing.

* Update the description IFF we were able to extract examples sections from it.

* Update doc comments and add missing file header for the newly added file.

* Make the example description readable. Add a check for empty example sections.

* Add a chooser right below the Example Usage header. Remove javascript as a language.

* Allow an empty new-line between short-codes boundaries.
2020-05-08 16:25:28 -07:00
Justin Van Patten d43a0dd3f8
Update NPM test to install @pulumi/pulumi 2.0 (#4596)
Future proof this test by depending on `@pulumi/pulumi` 2.0. `@pulumi/pulumi` 1.x depends on the native `grpc` package. In the future, when we run on future versions of Node.js, prebuilt native binaries of `grpc` might not be available which could result in this test failing.

In `@pulumi/pulumi` 2.0, we have moved to using `@grpc/grpc-js`, a pure JavaScript implementation, which doesn’t have this problem.
2020-05-08 11:15:43 -07:00
Praneet Loke 5613867b3b
[codegen/docs] Add apiextensions as a k8s overlay resource (#4583)
* Add apiextensions as a k8s overlay. Add comment.
2020-05-08 11:13:21 -07:00
Pat Gavlin fc00c16e31
[codegen/hcl2] Fix iterator apply rewrites. (#4589)
There are two expressions in HCL2 that are used to iterate over
collections:

- Splat expressions, e.g. `foo.*.bar`, and
- For expressions, e.g. `[for v in foo: v.bar]`

In both of these cases, the parts of the expression that are not the
collection being iterated behave like callbacks, and must be treated as
such by the apply rewriter.
2020-05-07 12:15:40 -07:00
Pat Gavlin 8fded5f29f
[codegen/hcl2] Fix template control tokens. (#4584)
Token detection was broken for conditional and for expressions that
represent template control sequences. The code originally attempted to
determine whether or not a conditional or for expression was a control
sequence by inspecting the expression's parent. Unfortunately, that
approach is unable to distinguish between expressions that are control
sequences and those that are merely template parts. These changes
instead inspect the first token of the expression for a template control
token (i.e. `%{`): if such a token is found, the expression is detected
as a template control sequence.
2020-05-07 09:12:00 -07:00
stack72 e701e24151 Ensure Go build is an optional step in integration testing framework
Fixes: #4585

This was happening by default in the test framework and then again
in the go language runtime

Also we were replacing a module and then running go mod tidy - this
is unnecessary - go mod download is sufficient here to ensure we
have the correct dependency we need. The tidy may have been removing
the replacements added
2020-05-07 09:23:05 +01:00
Praneet Loke 3b9ec6590b
[codegen/docs] Fix kubernetes resource docs links for overlay resources (#4578)
* Adjust the args type names for k8s overlay resources.

* Revert to using input type link for kubernetes non-overlay resources.

* Use the correct module name to lookup the C# namespace for resources that belong to a module.

* Helm's arg types don't use the version number.
2020-05-06 12:11:31 -07:00
Pat Gavlin f23b98a7df
[codegen/nodejs] Fix #4563. (#4579)
Do not wrap non-output-typed arguments to `pulumi.all` in
`pulumi.output`. `pulumi.all` does this implicitly.

Fixes #4563.
2020-05-06 10:09:20 -07:00
Pat Gavlin 0e512aa0ef
[codegen/{nodejs,python}] Parse more proxy applies (#4576)
Specifically, handle index and relative traversal expressions, and clean
up the code a little bit.

This should also help us pick up more `pulumi.interpolate` calls in TS.
2020-05-05 21:51:53 -07:00
Pat Gavlin 7b446d6c55
Escape """ in Python doc comments. (#4570)
With the addition of Python examples, doc comments may now contain
triple quotes. These must be escaped in order to avoid malformed source
files.

Fixes #4568.
2020-05-05 12:39:35 -07:00
Pat Gavlin 96300f12d9
[codegen/*] Improve range type binding + codegen. (#4552)
- Determine variable types for ranged resources by typechecking an
  equivalent expression
- Detect top-level await in NodeJS and generate an async main
- Fix `pulumi.all` generation for NodeJS
- Fix a bug in the lowering of relative traversals in Python
2020-05-04 15:04:35 -07:00
Lee Briggs 3e86202d5f
Merge pull request #4494 from pulumi/feature/gcs-retries
Retry bucket writes on error
2020-05-04 09:50:04 -07:00
Praneet Loke e66f4bd839
[codegen/docs] Remove exclusions used for Kubernetes' provider resource (#4551) 2020-05-03 16:27:33 -07:00
Paul Stack 3026395785
Add support for NPM Resolutions to nodejs codegen (#4554) 2020-05-02 22:17:31 +01:00
Praneet Loke fe3bd9ed99
[codegen/docs] Restore the API type links for C#. (#4543)
* Restore the API type links for C#.

* Also restore them in function.tmpl.

* Add package details to the Functions template as well. Add a global template function to detect if the APIDocLinks has links for a language. Don't generate C# API doc links for k8s.
2020-05-01 17:13:56 -07:00
Pat Gavlin d96f5263fb
Merge pull request #4548 from pulumi/pgavlin/codegenFixes
[hcl2] Fix package loading and trivia detection
2020-05-01 14:10:22 -07:00
Pat Gavlin 8c4c46052d Fix the entries() signature 2020-05-01 13:10:56 -07:00
Pat Gavlin 50b1049337 Fix a misspelling 2020-05-01 11:04:44 -07:00
Pat Gavlin 21634768aa [hcl2] Fix package loading and trivia detection
- Load packages referenced by all node types, not just resource nodes
- Fix trivia detection
2020-05-01 11:00:58 -07:00
Levi Blackstone cca94a5a71
Add helpers for downsteam Go codegen (#4546) 2020-05-01 11:52:07 -06:00
Pat Gavlin 4278595f1b [codegen/python] Fix case mapping in traversals.
This code was accidentally removed in a prior PR.

These changes also remove an assert; the situation the assertion guards
against is valid and occurs when dealing with traversals inside of
splat expressions.
2020-05-01 10:11:50 -07:00
Pat Gavlin 93a7dbe412
[hcl2/model] String literal + traversal fixes. (#4542)
- Properly escape string literals inside template expressions and
  heredocs
- Fix trailing trivia detection for scope and relative traversals
2020-05-01 06:29:39 -07:00
Mikhail Shilkov d91f658576
Codegen changes to prepare for C# Kubernetes schema (#4531)
Codegen changes to prepare for C# Kubernetes schema
2020-05-01 12:45:47 +02:00
Pat Gavlin ca5cb05482 [hcl2/model] String literal + traversal fixes.
- Properly escape string literals inside template expressions and
  heredocs
- Fix trailing trivia detection for scope and relative traversals
2020-04-30 16:38:36 -07:00
Pat Gavlin 1d6cce98fe
[codegen/python] Fix nested quotes. (#4539)
Unlike most languages with interpolated strings, Python's formatted
string literals do not allow the nesting of quotes. For example,
this expression is not legal Python:

    f"Foo {"bar"} baz"

If an interpolation requires quotes, those quotes nust differ from the
quotes used by the enclosing literal. We can fix the previous example
by rewriting it with single quotes:

    f"Foo {'bar'} baz"

However, this presents a problem if there are more than two levels of
nesting, as Python only has two kinds of quotes (four if the outermost
string uses """ or '''): in this case, the expression becomes
unspellable, and must be assigned to a local that is then used in place
of the original expression. So this:

    f"Foo {bar[f'index {baz["qux"]}']} zed"

becomes this:

    index = "qux"
    f"Foo {bar[f'index {baz[index]}']}"

To put it bluntly, Python code generation reqiures register allocation,
but for quotes. These changes implement exactly that.

These changes also include a fix for traversals that access values that
are dictionaries rather than objects, and must use indexers rather than
attributes.
2020-04-30 16:34:25 -07:00
Pat Gavlin 76a0f75f5e Fix a build break. 2020-04-30 14:52:38 -07:00
Pat Gavlin 5271eda247
[codegen/python] Fix case mapping. (#4538)
Mapping happens at package scope, not type scope. This is what causes
some of the surprising mixes of camel and snake casing in our packages.

In order to accommodate this, build the case mapping tables up front,
and refer to them when performing case mapping.
2020-04-30 14:16:56 -07:00
Pat Gavlin 1eff2b9acf
[hcl2/model] Propagate annotations in InputType. (#4535)
When creating the inputty version of an `ObjectType`, ensure that the
result carries any annotations present on the original type.
2020-04-30 14:16:43 -07:00
Pat Gavlin 6bd81de8aa
[hcl2] Fix tokens and printing for TraverseIndex. (#4536)
The tokens that make up the "key" portion of an index traversal
(e.g. `"foo"` in `a["foo"]`) are structured like those that make up a
block label: an open quote token, a string literal token, and a close
quote token. The token mapper did not account for that fact, and instead
recorded the key token as the open quote. These changes correct that
error, and adjust the code in `literalText` to allow for
properly-escaped and quoted strings where necessary.
2020-04-30 13:44:32 -07:00
Pat Gavlin 6ae15f6a44
[codegen/hcl] Fix binop printing. (#4537)
The code that handles automatic parenthesis insertion was broken for
operators with the same precedence.
2020-04-30 13:44:05 -07:00
Pat Gavlin b4daf94c2f
[codegen] Add support for caching package schemas. (#4534)
If a single process is going to bind and generate multiple programs, it
is useful to be able to cache package schemas in order to avoid the
(large) overhead of deserializing schemas multiple times.
2020-04-30 13:22:24 -07:00
Pat Gavlin 72a6add300
[codegen/python] Decrease alloc volume in PyName. (#4533)
Use strings.Builder instead of raw slices. We could go further here and
collapse to a single, ~right-sized bulder at the cost of complexity in
the `stateAcronym -> stateLowerOrNumber` transition.

Also, eliminate the pyName function, as it is redundant.
2020-04-30 13:22:13 -07:00
Paul Stack f06e48b414
Enable fish completions for pulumi cli (#4401) 2020-04-30 15:45:57 +01:00
Lee Briggs c5f9c2cca6
Don't skip npm tests 2020-04-28 14:13:56 -07:00
Lee Briggs 19587f5aa6
Rename skipIfShortFunction
As per feedback, use a more realistic name about what this function
does, including skip if there's no pulumi access token
2020-04-28 13:49:55 -07:00
Lee Briggs 06e6603475
Use PULUMI_ACCESS_TOKEN to skip tests 2020-04-28 10:09:39 -07:00
Lee Briggs 27f9f5c359
Don't try decrypt values on community PRs
When a community member sends a pull request to the repo, travis can't
decrypt some environment variables which include decrypting the GCP
credentials.
In addition to this, there are a few tests that run that require the
`PULUMI_ACCESS_TOKEN` which can't be used.

This PR does 2 things:

- Adds a check to the GCP credentials decryption which checks the source
  of the PR (whether it's from within the local repo, or a fork)
- Sets an environment variable: `COMMUNITY_PRS` which is used downstream
  during some tests. If the var exists, some tests are skipped

This should enhance the experience for community pull requests
significantly

Fixes #4508
2020-04-27 20:32:29 -07:00
Praneet Loke 7b17463031
[codegen/docs] Fix the generation of Function names, args, and result type names (#4490)
* Add a new DocLangHelper interface method to generate function names per language. Use the functionNames override map in Go to correctly generate a function name.

* Add kong to the title lookup map.

* Check if item was found in map.

* Use title case for the nodejs Function args type name. Use title case for the function name in the index page.

* Also fix the result name for a Function in nodejs to use title case.

* Use the module name to lookup the package.

* Use the title-case name for the Function name in the index page. Fix the language value passed to the lang chooser in function.tmpl.

* Use title case for nested type titles.

* Add title lookup for GitHub.
2020-04-27 17:47:01 -07:00
Lee Briggs c07e95e134
Build features/ 2020-04-27 17:43:37 -07:00
Lee Briggs 5bbcdd0a12
Merge remote-tracking branch 'upstream/master' into feature/gcs-retries 2020-04-27 17:17:38 -07:00
Lee Briggs 6a7adc8a16
Set delay and timeout for retries 2020-04-27 17:14:07 -07:00
Lee Briggs 8d7cb5d99a
Merge pull request #4489 from pulumi/jaxxstorm/ordered_secrets
Order secret outputs in stack references
2020-04-27 09:36:29 -07:00
Lee Briggs f4236ffcd3
Improve comment for output sorting
Co-Authored-By: Justin Van Patten <jvp@justinvp.com>
2020-04-25 12:37:05 -07:00
Pat Gavlin 2e9499a000
[codegen/hcl2] Fix the apply rewriter. (#4486)
Some of the apply rewriter's assumptions were broken by the richer
expressions available in HCL2. These changes fix those broken
assumptions, in particular the assumption that only scope traversal
expressions are sources of eventual values.
2020-04-24 22:04:24 -07:00
Lee Briggs 0086edb2d9
Retry bucket writes on error
When writing the snapshot to the filestate bucket, we can retry in the
event of an error, which helps users who are experiencing issues around
write rates to GCS
2020-04-24 16:41:56 -07:00
Komal 1d6af57442
Merge branch 'master' into komalali/increase-grpc-message-size 2020-04-24 13:42:54 -07:00
Pat Gavlin dc2d91e294
[codegen/hcl2] Separate binding and typechecking. (#4483)
This allows consumers to change the inputs to an expression and re-run
typechecking to compute the expression's new type.
2020-04-24 08:52:52 -07:00
Pat Gavlin af344d9b72
Fix Python module names. (#4473)
In particular, ensure that they are keyword-safe. This affects
`aws:lambda:*` in particular: prior to these changes, we were generating
code into `pulumi_aws.lamdba`, which is not referencable due to its use
of the `lamdba` keyword. With these changes, we generate code into
`pulumi_aws.lambda_`.

There is also a small fix for multi-line non-formatted strings: these
strings do not need escaped braces.
2020-04-24 08:52:36 -07:00
Pat Gavlin 739634c702
Merge pull request #4475 from pulumi/pgavlin/applies
Apply rewriter: separate global and expr data
2020-04-24 08:52:14 -07:00
Lee Briggs 043f5d87d4
Merge pull request #4476 from jaxxstorm/io-log-messaging
Change the wording of some IO errors
2020-04-24 08:45:26 -07:00
Paul Stack 090f390d7b
Ensure that DotNet codegen marks Deprecated classes as obsolete (#4482)
Related: https://github.com/pulumi/pulumi-terraform-bridge/issues/133
2020-04-24 01:18:29 +01:00
Lee Briggs b9f44813fb
Order secret outputs in stack references
When referencing `secretOutputNames` in from another stack, spurious
diffs can often be created because the secret output slice was not
ordered.

This PR orders the slice before it's added to the propertymap, ensuring
the order always remains the same
2020-04-23 15:57:20 -07:00
Komal Ali cc96df7485 update channel options in go 2020-04-23 11:16:36 -07:00
Praneet Loke ffeeed965f
[codegen/go] Handle recursive types when marking optional properties to use Ptr types in Go (#4471) 2020-04-22 16:49:57 -07:00
Lee Briggs e74f797dbd
Change the wording of some IO errors
This probably seems like a trivial change, but while debugging #4258 it
was apparent that an error could have come from 3 different places. This
rewords an error message to make it slightly clearer what the error is.
2020-04-22 16:43:44 -07:00
Pat Gavlin 18ecd1c8a9 Apply rewriter: separate global and expr data
This will make some incoming fixes that address nested applies easier to
write and understand.
2020-04-22 15:48:56 -07:00
Mikhail Shilkov b67c774fcc
C# name resolution (#4468) 2020-04-23 00:42:31 +02:00
Pat Gavlin 3a45d46046
Fix output property names in Python codegen. (#4460)
* Fix output property names in Python codegen.

Some property names are mapped from their `camelCase` Pulumi name to a
`snake_case` Python name. This mapping is irregular, and only occurs for
resources properties and function calls.

Note that there's still more work to do here: this only fixes names on
the output side; the input side is still broken for nested resource
proprerties and function calls.

The underlying design--annotated types in `hcl2/model`--may need some
additional work in the future, but I _believe_ it's good enough for now.

* Fix Python input property names.

- Fix input property names and forms for invokes. Previously we
  generated a dict; now we generate properly-named args.
- Fix nested property names for resources.

* PR feedback
2020-04-22 10:25:19 -07:00
Praneet Loke 6f43784cf8
[codegen/docs] Add an exclusion to manually render the k8s overlay resource constructor params for Python (#4469) 2020-04-22 10:13:35 -07:00
Pat Gavlin 4f0aec56f6 PR feedback 2020-04-21 15:38:42 -07:00
Paul Stack 777b295b6a
Add flag to pulumi stack to output only the stack name (#4450)
Fixes: #4444

Before:
```
$ pulumi stack
Current stack is 47BE2956-D665-4EC3-9AE6-4D4A1C417074:
    Managed by demo-mbp
    No updates yet; run 'pulumi up'
Current stack resources (0):
    No resources currently in this stack

Use `pulumi stack select` to change stack; `pulumi stack ls` lists known ones
```

After:
```
$ pulumi stack --show-name
47BE2956-D665-4EC3-9AE6-4D4A1C417074
```
2020-04-21 23:35:28 +01:00
Pat Gavlin 9204d70c54 Fix Python input property names.
- Fix input property names and forms for invokes. Previously we
  generated a dict; now we generate properly-named args.
- Fix nested property names for resources.
2020-04-21 13:55:33 -07:00
Luke Hoban 6afefe050f
[codegen/go] Fix accessors on struct ptr outputs (#4456)
* [codegen/go] Fix accessors on struct ptr outputs

The accesor methods on nestred struct Ptr outputs were previously not accepting pointer typed inputs as they should, and would thus always panic if used.

The "simple" fix would be to just accept the pointer type and blindly dereference it.  But this doesn't seem like the right experience - it would make these accessors very unsafe to use in practice.

Instead, this PR implements the accessors on pointer-typed outputs as nil-coaslescing, always lifting the output type into a pointer type and flowing a nil value into the result type.  This ensures the accessor will not nil-deref, and that user code can handle the `nil` value itself (or use `.Apply` directly to implement more specialized behaviour).

Before:

```go
// Name of your S3 bucket.
func (o BuildStorageLocationPtrOutput) Bucket() pulumi.StringOutput {
	return o.ApplyT(func(v BuildStorageLocation) string { return v.Bucket }).(pulumi.StringOutput)
}
```

After:

```go
// Name of your S3 bucket.
func (o BuildStorageLocationPtrOutput) Bucket() pulumi.StringPtrOutput {
	return o.ApplyT(func(v *BuildStorageLocation) *string {
		if v == nil {
			return nil
		}
		return &v.Bucket
	}).(pulumi.StringPtrOutput)
}
```

However, due to the decision to have this more usable behaviour, this is a breaking change, as some/many accessors now return a pointer type when they previously did not.

Fixes pulumi/pulumi-azure#530.

* Mark nested property types as requiring ptr types

* Add CHANGELOG

* More fixes
2020-04-21 13:33:38 -07:00
Pat Gavlin 1d672563da Fix output property names in Python codegen.
Some property names are mapped from their `camelCase` Pulumi name to a
`snake_case` Python name. This mapping is irregular, and only occurs for
resources properties and function calls.

Note that there's still more work to do here: this only fixes names on
the output side; the input side is still broken for nested resource
proprerties and function calls.

The underlying design--annotated types in `hcl2/model`--may need some
additional work in the future, but I _believe_ it's good enough for now.
2020-04-21 10:25:27 -07:00
Pat Gavlin 807cf44cd7
Codegen: collect imports from function calls. (#4445)
Codegen: collect imports from function calls; fix Python resource names.

Just what it says on the tin.
2020-04-21 10:24:42 -07:00
Sean Holung 5d9e3626b3
[codegen/docs] Improve titles tags and meta descriptions (#4432)
* Optimize titles and descriptions

* Move regexp to file level variable

* wip

* Add title tags and description to module and pkg index pages

* Remove block_external_search_index from index.tmpl

* Improve resource descriptions

* Add more providers to look up map

* Improve module level descriptions

Clean up

cleanup

* Update the function.tmpl with the auto-generated disclaimer. Pass title tag and meta description for the function template as well.

* Fix whitespace in the package_details template..

* Account for empty module names for package-level resources. Move logic for generating title tag and description into separate methods for Resources and Functions.

* Add a test for the generated resource and function title tag.

Co-authored-by: Praneet Loke <1466314+praneetloke@users.noreply.github.com>
2020-04-21 12:28:44 +01:00
Pat Gavlin 1f19cbbe08
Clean up the language-specific schema APIs. (#4454)
Rather than forcing consumers to deal with language-specific data
ad-hoc, add an API that allows all language-specific data to be decoded
up-front.
2020-04-20 16:36:05 -07:00
Chris Smith ce5fd47558
Fix hang if PersistentPreRun fails (#4411)
* Fix hang if PersistentPreRun fails

* Close channel at end of function if check not started

* Block if channel still open
2020-04-20 14:25:50 -07:00
Justin Van Patten 5328b6801f
Inject id resource output property in docs (#4443)
All resources have an implicit `id` output property that must be injected in docs.
2020-04-18 14:17:08 -07:00
Justin Van Patten a9fac0c51c
Add a period to the end of the Context object comment (#4440)
To match the other comments that have periods.
2020-04-18 13:06:43 -07:00
Paul Stack aadc17a488
Merge pull request #4441 from pulumi/stack72/gh-4405
Protect against panic when unprotecting state with no resources
2020-04-18 17:51:25 +01:00
Cameron Stokes ddc6f05abc
Fix typo in --replace help output (#3719) 2020-04-18 14:21:14 +01:00
stack72 b7a3d73f69 Protect against panic when unprotecting state with no resources
Fixes: #4405
2020-04-18 14:19:56 +01:00
Justin Van Patten c04d1beaab
Fix header anchor ids in resource docs (#4436)
* Add ids to headers so they can be linked to

* Make header ids more general

Rather than including the identifier in the name of the id, use a simpler more generic id.

* H3=>H2 for Modules/Resources/Functions/Package Details headings

This way, on individual resource/function pages, it doesn't make it look like "Package Details" is a sub heading under "Supporting Types" in the right-hand "ON THIS PAGE".
2020-04-18 02:45:47 -07:00
Sean Holung 06c4c6b0a8
Polish input and output props (#4408)
* Polish input and output props

* Add resource name to heading.

* Update pkg/codegen/docs/templates/resource.tmpl

Co-Authored-By: Christian Nunciato <c@nunciato.org>

* Update pkg/codegen/docs/templates/resource.tmpl

Co-Authored-By: Christian Nunciato <c@nunciato.org>

* Update pkg/codegen/docs/templates/resource.tmpl

Co-Authored-By: Justin Van Patten <jvp@justinvp.com>

* Update pkg/codegen/docs/templates/resource.tmpl

Co-Authored-By: Justin Van Patten <jvp@justinvp.com>

* Fix relref links

Co-authored-by: Christian Nunciato <c@nunciato.org>
Co-authored-by: Justin Van Patten <jvp@justinvp.com>
2020-04-17 16:48:47 -07:00
Chris Smith df1b07b9dc
Add support for a PULUMI_CONSOLE_DOMAIN env var (#4410)
* Add support for a PULUMI_CONSOLE_DOMAIN env var

* Fix typo

* Update CHANGELOG.md

* Fix tests

* Address PR feedback
2020-04-17 11:50:00 -07:00
Chris Smith 2c03c158e2
Annotate .ctor args in docs (#4385)
* Annotate .ctor args in docs

* Update pkg/codegen/docs/gen.go

Co-Authored-By: Praneet Loke <1466314+praneetloke@users.noreply.github.com>

* Mark ctor params as required/optional

* Address PR feedback

* Address PR feedback

Co-authored-by: Praneet Loke <1466314+praneetloke@users.noreply.github.com>
2020-04-17 11:46:02 -07:00
Praneet Loke 78e9621379
[codegen/docs] Allow specifying the languages to show in the lang chooser (#4426)
* Add auto-generated disclaimer for the resource.tmpl as well.

* Allow specifying the languages to show in the lang chooser. Hide the go language for k8s overlay resources.

* Add another exclusion for generating the C# constructor param for k8s overlay resources.

* Replace hard-coded exclusions for skipping input properties with checking for ConstValue attribute of input properties.
2020-04-17 11:45:06 -07:00
Sean Holung 854a1d5758
Add version to package details (#4433) 2020-04-17 11:39:19 -07:00
Pat Gavlin f081d98a39
HCL2: support for tolerating missing variables. (#4430)
When this tolerance is enabled, diagnostics will not be emitted for
missing variables.
2020-04-17 08:24:44 -07:00
Pat Gavlin 398878de31
Various codegen updates. (#4424)
- Define `null` in Pulumi HCL2
- Bind Pulumi HCL2 in topological order s.t. variable types can be
  properly computed
- Fix resources that range over bools and numbers
- Add element, length, lookup, readFile, and split functions
- Do not rewrite function signatures with input types during binding
- Fix splat expression binding for non-lists
- Add support for evaluating expressions
- Add support for operator precedence to code generators
- Add support for constants to the HCL2 IR
- Add support for generating ranged resources in Python
- Add support for generating conditional resource in Node and Python
- Fix various naming issues in Python
2020-04-16 16:44:34 -07:00
stack72 b7da2d8d81 Update pkg/v2 to use sdk/v2.0.0 release 2020-04-16 17:56:05 +01:00
Justin Van Patten 9b0c10c181
Fix number of args expected for policy disable (#4415)
It expects one arg. Currently, we panic if no arg is specified. This fixes that.
2020-04-16 08:56:14 -07:00
Justin Van Patten 7f27618e2d
Avoid replace on second update with import applied (#4403)
After importing some resources, and running a second update with the
import still applied, an unexpected replace would occur. This wouldn't
happen for the vast majority of resources, but for some it would.

It turns out that the resources that trigger this are ones that use a
different format of identifier for the import input than they do for the
ID property.

Before this change, we would trigger an import-replacement when an
existing resource's ID property didn't match the import property, which
would be the case for the small set of resources where the input
identifier is different than the ID property.

To avoid this, we now store the `importID` in the statefile, and
compare that to the import property instead of comparing the ID.
2020-04-15 18:52:40 -07:00
Sean Holung 7834f2fcb2
Generate links for primitive types. (#4386) 2020-04-15 12:56:28 -07:00
Praneet Loke c830017383
[codegen/docs] Cleanup generating links for Pulumi types (#4395)
* Add a method to the DocLanguageHelper interface to get the API doc link for Pulumi types.

* Add a test for Go API doc link methods.

* Use GetDocLinkForPulumiType in gen_function as well.
2020-04-15 11:58:08 -07:00
Mikhail Shilkov 91dce426b2
Use Config.Get for string-based token types in .NET code gen (#4399) 2020-04-15 19:59:02 +02:00
Luke Hoban 39eeaef92d
[codegen] Generate correct links to v>=2 of Go packages (#4346) 2020-04-14 13:59:23 -07:00
Sean Holung dd413723ad
Remove display of optional type identifiers. (#4374) 2020-04-14 13:34:53 -07:00
Mikhail Shilkov 9077292d14
Fix the namespace capitalization in C# codegen (#4392) 2020-04-14 19:53:43 +01:00
stack72 74df34be75 Re-enabling dockerfile latest, docs and homebrew publishing
These had previously been disabled due to the beta releases. Also
fixes an import path for finding an executable
2020-04-14 09:40:11 +01:00
CyrusNajmabadi 66bd3f4aa8
Breaking changes due to Feature 2.0 work
* Make `async:true` the default for `invoke` calls (#3750)

* Switch away from native grpc impl. (#3728)

* Remove usage of the 'deasync' library from @pulumi/pulumi. (#3752)

* Only retry as long as we get unavailable back.  Anything else continues. (#3769)

* Handle all errors for now. (#3781)


* Do not assume --yes was present when using pulumi in non-interactive mode (#3793)

* Upgrade all paths for sdk and pkg to v2

* Backport C# invoke classes and other recent gen changes (#4288)

Adjust C# generation

* Replace IDeployment with a sealed class (#4318)

Replace IDeployment with a sealed class

* .NET: default to args subtype rather than Args.Empty (#4320)

* Adding system namespace for Dotnet code gen

This is required for using Obsolute attributes for deprecations

```
Iam/InstanceProfile.cs(142,10): error CS0246: The type or namespace name 'ObsoleteAttribute' could not be found (are you missing a using directive or an assembly reference?) [/Users/stack72/code/go/src/github.com/pulumi/pulumi-aws/sdk/dotnet/Pulumi.Aws.csproj]
Iam/InstanceProfile.cs(142,10): error CS0246: The type or namespace name 'Obsolete' could not be found (are you missing a using directive or an assembly reference?) [/Users/stack72/code/go/src/github.com/pulumi/pulumi-aws/sdk/dotnet/Pulumi.Aws.csproj]
```

* Fix the nullability of config type properties in C# codegen (#4379)
2020-04-14 09:30:25 +01:00
Evan Boyle 90ced9574d
fix go config codegen (#4388)
* fix go config codegen

* changelog
2020-04-14 09:24:32 +01:00
Pat Gavlin 51588ede49
Fix various printing issues. (#4378)
- Parentheses were not handled properly
- Literals inside of template control sequences were not handled
  properly

These changes also improve test coverage for the printers.
2020-04-13 19:11:56 -07:00
Praneet Loke 931da8f109
[codegen/docs] Fix Kubernetes resource links for NodeJS and C# constructor params (#4384)
* Fix k8s input type links for constructor args.

* Skip using property case maps for k8s Python.

* Fix the namespace of C# constructor args type and resource type.
2020-04-13 17:27:38 -07:00
Erin Krengel 562d1298f2
fix link to be lowercase (#4382) 2020-04-13 15:48:36 -07:00
stack72 69c804a4e7 Adding system namespace for Dotnet code gen
This is required for using Obsolute attributes for deprecations

```
Iam/InstanceProfile.cs(142,10): error CS0246: The type or namespace name 'ObsoleteAttribute' could not be found (are you missing a using directive or an assembly reference?) [/Users/stack72/code/go/src/github.com/pulumi/pulumi-aws/sdk/dotnet/Pulumi.Aws.csproj]
Iam/InstanceProfile.cs(142,10): error CS0246: The type or namespace name 'Obsolete' could not be found (are you missing a using directive or an assembly reference?) [/Users/stack72/code/go/src/github.com/pulumi/pulumi-aws/sdk/dotnet/Pulumi.Aws.csproj]
```
2020-04-12 21:37:52 +01:00
Praneet Loke 563233d16c
[codegen/docs] Use the correct module names for languages. (#4367)
* Use the correct module names for languages.

* Add Kubernetes to the title lookup map.

* Add output properties to the map only if filtered output properties is non-zero length.
2020-04-10 18:28:14 -07:00
Sean Holung f28bf6acf5
Remove input props from output properties list (#4360)
* Remove input properties from displaying in output props list
2020-04-10 16:12:05 -07:00
Praneet Loke 729ae08c9d
Handle k8s cases in the resource doc generator (#4337)
* Add a check for the Python code gen to prevent infinte recursion. Remove the custom logic for k8s for generating Python property case maps.

* Fix bug with C# links for k8s constructor resources.

* Apply a style on the deprecation message.

* Use the display name when rendering a property type that does not have a link.

* Fix the python type string generator for docs to inspect union types.

* Update cleanTypeString to account for nodejs package names.

* Add missing lookup names for packages.
2020-04-10 14:07:52 -07:00
Harrison Heck 01d22680d9 fix: error when setting config without value in non-interactive mode 2020-04-10 19:23:32 +01:00
Harrison Heck 5dd669168b fix: remove --show-* as persistent flags 2020-04-10 17:01:12 +01:00
Harrison Heck 7f3ea52202 fix: logging out with filestate when url is deleted 2020-04-10 15:02:24 +01:00
Harrison Heck 43d310ee6d fix: up with refresh with targets not limiting refresh 2020-04-10 15:00:54 +01:00
Pat Gavlin 71aa0f020f
Fix treatment of trivia in template expressions. (#4352)
And improve test coverage for the same.
2020-04-09 16:37:52 -07:00
Evan Boyle c3b2439094
Automate execution of go mod download for pulumi new Go templates (#4353) 2020-04-09 16:16:10 -07:00
Sean Holung 9cd7d7c5c0
Group required resource properties at top of list (#4351) 2020-04-09 15:57:17 -07:00
Sean Holung 7a2f020d2e
Map display names for API Reference TOC menu (#4339) 2020-04-09 09:43:38 -07:00
Levi Blackstone ca6e47277f
Handle const values in Go codegen (#4311) 2020-04-08 10:33:01 -06:00
Pat Gavlin e9d8ccd0cc
Move pulumi cmd sources into cmd/pulumi. (#4324)
Just what it says on the tin.
2020-04-07 15:53:20 -07:00
Praneet Loke efaa026196
Make sure there is a new-line between the package description and the first header on the index page. (#4312) 2020-04-07 12:27:35 -07:00
Pat Gavlin 00f1433706
HCL2/NodeJS: fix proxy apply lowering for promises (#4317)
Applies cannot be proxied when the applied value is a promise.

Fixes #4315.
2020-04-07 09:25:50 -07:00
Pat Gavlin 2f22c1c59c
HCL2 updates (#4309)
Pulumi HCL2 IR:
- Add support for invokes
- Add support for resource options, incl. ranged resources
- Allow the apply rewriter to ignore promise-typed values
- Add tests for the binder
- Add support functions for TF: entries and range

NodeJS codegen:
- Simplify for expression codegen
- Add support for invoke codegen
- Add support for entries and range functions
- Add tests

Python codegen:
- Implement codegen for most expression types
- Add support for invoke codegen
- Add tests
2020-04-06 19:43:16 -07:00
Praneet Loke 50e1086124 Make sure there is a new-line between the package description and the first header on the index page. 2020-04-06 17:43:21 -07:00
Praneet Loke 22aeaa43b1
Move resource docs index file generation to Go templates (#4308)
* Add new templates for generating index files. Remove the now irrelevant code.

* Add comment for generating index files by deduping module names. Use the path format of a module name as the link.

* Add a trailing slash for module links in the index page.

* Move the categories rendered in the index file into their own template file. Handle kubernetes provider specific module name conversion while generating parent modules.

* Fix issue with the k8s provider resource being generated as a module rather than a resource on the package-level index page.

* Show the deprecation message of a resource at the top of the document.

* Move k8s specific things to its own file.

* Add title attribute to the list items. Show the last part of a module name, in case it contains path separators

* Lookup the package name from the Go language info object for k8s then use that to lookup the C# namespace.

* Move the logic for cleaning a property type string for display names to a separate function.

* Export the title function from go and dotnet code generators for use in the resource doc generator. Use the title function from the respective lang code gens to match the correct title case used there. Fix issue with the Kubernetes namespace not being stripped for C# property type strings.

* Skip including apiVersion and kind as input properties for Kubernetes until pulumi-kubernetes#1062 is merged.
2020-04-06 17:01:33 -07:00
Evan Boyle ab659aa0c1
Reimplement getRequiredPlugins for go sdk (#4297) 2020-04-06 12:30:40 -07:00
Lee Zen 4862d73186
Do not show the update version warning with --json flag (#4255)
Co-authored-by: Lee-Ming Zen <lee@pulumi.com>
2020-04-03 14:52:53 -07:00
Praneet Loke ea383991f2
Update resource docs generator to handle some k8s cases (#4270)
* Fix an issue with stripping the module name from type doc links in nodejs.

* Remove unused code that visited object types. Update the nested types code to account for types that may reference themselves. Added glog logging statements. Save the package-level language info objects, so we can use them later.

* Check if a type token has already been added as an input or an output type when collecting nested types.

* Rename appearsIn to typeUsage.

* Scan provider resource also using the special-case function if package is k8s.

* Simplify the display names for Pulumi types by removing the Pulumi prefix.
2020-04-03 11:26:52 -07:00
Pat Gavlin b02a84b8d9
Add a code generator for Python programs. (#4285)
This code generator processes a bound Pulumi program represented using
an HCL2-based IR and converts it to an equivalent Python program.
2020-04-02 23:29:05 -07:00
Pat Gavlin 4ae2867a15
Add a code generator for NodeJS programs. (#4284)
This code generator processes a bound Pulumi program represented using
an HCL2-based IR and converts it to an equivalent NodeJS program.
2020-04-02 23:27:05 -07:00
Pat Gavlin 742c047211 Remove an unused import 2020-04-02 22:09:50 -07:00
Pat Gavlin 1860b4f656 Appease the linter 2020-04-02 21:43:03 -07:00
Pat Gavlin e831ecbc0e Update package references 2020-04-02 21:25:30 -07:00
Pat Gavlin 2f5238f130 Updates to the Pulumi HCL2 projection
- config variables are now specified as `config <name> <type>`
- output variables are now specified as `output <name> <type>`
- apply arguments are assigned better names by the apply rewriters
2020-04-02 21:25:30 -07:00
Pat Gavlin 89c9401fad Appease the linter 2020-04-02 21:25:30 -07:00
Pat Gavlin aa655c6076 Add a package for binding HCL2 as Pulumi config.
These changes add preliminary (read: incomplete) support for
representing Pulumi programs using HCL2. Language-specific code
generators can use this representation as a basis for understanding the
semantics of a Pulumi program.
2020-04-02 21:25:30 -07:00
Pat Gavlin c5782115d2
Various updates to the HCL2 semantic model. (#4281)
- Improve support for printing and triva
- Add support for HCL2 type functions
- Add visitors for body items
2020-04-02 21:23:12 -07:00
Levi Blackstone e92b1b4e8d
Add schema support for constant values (#4283)
Some properties have constant values, such as the
apiVersion and kind for the Kubernetes provider. Add
a Const field to the Property schema to support this.
2020-04-02 21:47:07 -06:00
Pat Gavlin a597934b3c
Updates to the HCL2 syntax helpers. (#4282)
- Fix token mapping for template control structures
- Split tokens out into their own file
- Add factory methods for token types
2020-04-02 20:01:14 -07:00
Evan Boyle 3efbc3705d
Update go codegen to include usage hints on Input types (#4279) 2020-04-02 19:59:08 -07:00
Justin Van Patten 9c82975478
Remove [PREVIEW] from policy commands (#4277) 2020-04-02 11:53:41 -07:00
Luke Hoban d018212adc
[codegen/docs] Skip adding Notes to package details if empty (#4275) 2020-04-02 11:26:11 -07:00
Luke Hoban a0f615ad09
Add package details and atttribution to schema (#4256) 2020-04-01 17:22:23 -07:00
Justin Van Patten 344885823e
Add Python support to pulumi policy new (#4263)
Instead of always running `npm install`, if the Policy Pack is Python, emit instructions on how to install dependencies. Also minor cleanup/refactoring.
2020-04-01 13:31:38 -07:00
Paul Stack dfe0210fc4
Merge pull request #4251 from pulumi/fixup-get-py-version
Move BuildUtil class to sdk
2020-03-31 14:52:54 +01:00
stack72 a1af9289c3 Move BuildUtil class to sdk
This was still in pkg and wasn't accessible from the scripts location.
This code should be in the go/common location of sdk so that it can be
accessed from within our build scripts

Without this change, we were not able to get access to the Version number
for Python and none of our Python builds have been publishing binaries
2020-03-31 12:07:24 +01:00
Christian Nunciato 7e46e7580f
Resource template fixes (#4245) 2020-03-31 04:07:04 -07:00
Christian Nunciato 21ee0919cd Update the resource-docs templates 2020-03-30 14:38:29 -07:00
Praneet Loke bdc12b2c98
Fix csharp and nodejs doc links generated by resource docs generator (#4237)
* Decode the C# language info from the schema package and set it in the dotnet lang helper for docs. Pass the qualifier for C# property type strings based on whether it is an input or an output property.

* Don't pass a module name for Pulumi core types used in TS constructor and Function params.

* Add tests for generating doc links for nodejs types.

* Add test for confirming input doc link for C# type.

* Fix the C# type name for InvokeOptions.
2020-03-30 14:37:30 -07:00
Justin Van Patten e6be38e285
PaC: Add initial config support for policy packs (#4233)
The initial config represents any config that was specified programmatically to the Policy Pack, for Policy Packs that support programmatic configuration like AWSGuard.
2020-03-30 12:52:05 -07:00
Dominik-K 77af9e0eac
print full Pulumi Cloud stack name in errors for stack select (#3933) 2020-03-30 12:18:53 -07:00
Evan Boyle 7c08ba4583
remove dep ensure message from pulumi new *go* (#4232) 2020-03-30 12:05:28 -07:00
Erin Krengel 319833acdb
dont add PPs to refresh summary event (#4193) 2020-03-27 13:21:28 -07:00
Sean Holung 7b91dc20a8
Add cmd to support policy pack config validation (#4186)
* Add cmd `pulumi policy validate-config` to do policy pack config validation
2020-03-27 09:54:26 -07:00
Tasia Halim 655def51b3
Add word breaks to nested type names (#4191) 2020-03-26 12:42:15 -07:00
Praneet Loke 651d951416
Remove non-relevant examples and empty examples section from docs comments (#4184)
* Add tests for the examples processing.

* Update the schema-based code generators to strip out non-relevant code examples wrapped in short-codes.

* Extract language relevant examples for Functions too.

* Simpler way of extracting the surrounding text from the description.

* Add some more new-line characters to clean-up the examples sections.
2020-03-26 10:30:04 -07:00
Evan Boyle 80f1989600
Removing the need for vendoring (#4167) 2020-03-25 15:57:46 -07:00
Tasia Halim bdefc557af make comment htmlSafe 2020-03-25 12:37:03 -07:00
Sean Holung d0f5e35b50
Add support for enabling Policy Packs with configuration (#4127)
* Support policy pack configiguration using policy enable cmd.
2020-03-24 13:30:36 -07:00
Levi Blackstone 8ce10e1dfe
Add aliases to the Go SDK codegen pkg (#4157) 2020-03-24 11:18:21 -06:00
Erin Krengel c62d52690c
Bump accept header to 6 for pac config (#4162) 2020-03-24 09:00:34 -07:00
Praneet Loke ab080c0c5d
Fix the signature for C# invokes in the resource docs generator (#4134)
* Update the C# invoke signature in the Functions template used by resource docs generator.

* Add a new function to the DocLanguageHelper interface for resource docs generator to generate language-specific property names.

* Add a new DisplayName property to the propertyType struct for simpler display names without module names.

* Update templates to use the DisplayName property of propertyType. Strip the namespace/module name from type names for use as display names.
2020-03-23 14:17:14 -07:00
Evan Boyle 61928f04e0
fix go.mod dependencies (#4152) 2020-03-22 12:48:43 -07:00
Evan Boyle 1c4496a180
Merge pull request #4109 from pulumi/evan/gomod
Go Modules
2020-03-20 12:01:25 -07:00
Praneet Loke 861d568eb2
Add test for resource docs to confirm Python casing (#4126)
* Generate Go package maps at the beginning, so that the resource docs can use the appropriate package context for generating a property type string name.
2020-03-20 08:17:58 -07:00
evanboyle 269cef2142 Revert "fix python versioning to be semver compliant"
This reverts commit de100bafd4.
2020-03-19 17:00:23 -07:00
evanboyle fcc63aaf76 Revert "fix python versioning"
This reverts commit eea42b8a67.
2020-03-19 16:59:58 -07:00
evanboyle eea42b8a67 fix python versioning 2020-03-19 15:59:57 -07:00
evanboyle de100bafd4 fix python versioning to be semver compliant 2020-03-19 14:10:21 -07:00
evanboyle ce1928988b Merge branch 'master' of https://github.com/pulumi/pulumi into evan/gomod 2020-03-19 13:01:38 -07:00
evanboyle 1fec5692a5 duplicate version to ensure linking is properly handled 2020-03-19 12:49:34 -07:00
Praneet Loke 5ecf24ee81
Update the resource docs generator to use the correct casing for nested property names in Python (#4111)
* Temporarily block the resource docs from search indexing.

* Use PascalCase for nested type names in Python.

* Fix bug with Python property name casing for nested types by checking the property case maps.
2020-03-19 12:18:18 -07:00
evanboyle a2b368827f fix internal logging usage 2020-03-19 11:45:10 -07:00
evanboyle 4e44854308 replace glog with klog 2020-03-19 08:56:44 -07:00
Mikhail Shilkov 0f4e5a6a0b
Fix Go generation (#4113) 2020-03-19 16:41:43 +01:00
Luke Hoban 65899569ee
Fix Type suffix Go codegen for cross-package references (#4110)
* Avoid adding "Type" suffix unnecessarily

* Fix `Type` suffix for cross-package references

* Fix mixxing imports and format code
2020-03-19 08:32:40 -07:00
evanboyle ec686bbaf6 Merge branch 'master' of https://github.com/pulumi/pulumi into evan/gomod 2020-03-18 17:57:58 -07:00
Lee Zen 984f8590f8
Fix rename stack message when attempting to move organizations (#4098)
* Fix rename stack message when attempting to move organizations
* Include the URL to change stack ownership

Co-authored-by: Lee-Ming Zen <lee@pulumi.com>
2020-03-18 17:54:38 -07:00
evanboyle d3f5bbce48 go fmt 2020-03-18 17:27:02 -07:00
evanboyle 1fa50398e2 update go.mods to pin to correct version of pb 2020-03-18 17:25:42 -07:00
evanboyle 71926f1af8 update go.mod after moving the language hosts back to /sdk 2020-03-18 17:16:16 -07:00
evanboyle 67f6b72caa Revert "move sdk/go/pulumi-language-go -> pkg/cmd/pulumi-language-go"
This reverts commit 7ea547a14d.
2020-03-18 17:14:41 -07:00
evanboyle 56c1dd7012 Revert "move sdk/dotnet/cmd/pulumi-language-dotnet -> pkg/cmd/pulumi-language-dotnet"
This reverts commit b7ea8198de.
2020-03-18 17:13:46 -07:00
evanboyle d93017dbde Revert "move sdk/nodejs/cmd/pulumi-language-nodejs -> pkg/cmd/pulumi-language-nodejs"
This reverts commit a73044247e.
2020-03-18 17:12:55 -07:00
evanboyle 48250176a1 Revert "move sdk/python/cmd/pulumi-language-python -> pkg/cmd/pulumi-language-python"
This reverts commit e2ee46fb23.
2020-03-18 17:11:56 -07:00
Levi Blackstone 5a730d6ebc
Use Go's file handling libs for integration test framework (#4107)
Rather than shelling out to the `rm` and `cp` commands,
use Go's os utils to perform these operations. This will
work on any platform rather than just Linux.
2020-03-18 17:57:50 -06:00
evanboyle be4b523e55 create go.mod for top level packages pkg sdk examples tests 2020-03-18 16:30:44 -07:00
Justin Van Patten 24e804bbe8
Support for running Python policy packs (#4057)
These changes enable running policy packs written in Python.
2020-03-18 16:15:57 -07:00
evanboyle 6933745342 move pkg/tools -> sdk/go/common/tools 2020-03-18 15:56:58 -07:00
evanboyle a4ec3ec81b move pkg/testing -> sdk/go/common/testing, leave behind pkg/testing/integration 2020-03-18 15:55:41 -07:00
evanboyle 0e9c5989bb move pkg/util/gitutil -> sdk/go/common/util/gitutil 2020-03-18 15:52:09 -07:00
evanboyle df722e974a move pkg/util/archive -> sdk/go/common/util/archive 2020-03-18 15:50:04 -07:00
evanboyle 30e1a5917e move pkg/util/fsutil -> sdk/go/common/util/fsutil 2020-03-18 15:48:38 -07:00
evanboyle 33e23bdf0c move pkg/util/retry -> sdk/go/common/util/retry 2020-03-18 15:47:01 -07:00
evanboyle c1440e48d4 move pkg/util/result -> sdk/go/common/util 2020-03-18 15:45:42 -07:00
evanboyle fa348ceb1b move pkg/util/ciutil -> sdk/go/common/util/ciutil 2020-03-18 15:43:31 -07:00
evanboyle c1d3a8524b move pkg/util/cmdutil -> sdk/go/common/util/cmdutil 2020-03-18 15:39:00 -07:00
evanboyle 7ff46cb4fa move pkg/util/rpcutil -> sdk/go/common/util/rpcutil 2020-03-18 15:37:13 -07:00
evanboyle c3f6ae2451 move pkg/util/logging -> sdk/go/common/util/logging 2020-03-18 15:34:58 -07:00
evanboyle cdfb8608c9 move pkg/encoding -> sdk/go/common/encoding 2020-03-18 15:28:19 -07:00
evanboyle 30df499838 move pkg/version -> sdk/go/common/version 2020-03-18 15:25:25 -07:00