@pulumiverse/gandi 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +407 -0
- package/config/index.d.ts +1 -0
- package/config/index.js +21 -0
- package/config/index.js.map +1 -0
- package/config/vars.d.ts +16 -0
- package/config/vars.js +31 -0
- package/config/vars.js.map +1 -0
- package/domains/dnssecKey.d.ts +84 -0
- package/domains/dnssecKey.js +67 -0
- package/domains/dnssecKey.js.map +1 -0
- package/domains/domain.d.ts +94 -0
- package/domains/domain.js +64 -0
- package/domains/domain.js.map +1 -0
- package/domains/getDomain.d.ts +38 -0
- package/domains/getDomain.js +22 -0
- package/domains/getDomain.js.map +1 -0
- package/domains/getGlueRecord.d.ts +50 -0
- package/domains/getGlueRecord.js +23 -0
- package/domains/getGlueRecord.js.map +1 -0
- package/domains/glueRecord.d.ts +96 -0
- package/domains/glueRecord.js +65 -0
- package/domains/glueRecord.js.map +1 -0
- package/domains/index.d.ts +6 -0
- package/domains/index.js +54 -0
- package/domains/index.js.map +1 -0
- package/domains/nameservers.d.ts +60 -0
- package/domains/nameservers.js +54 -0
- package/domains/nameservers.js.map +1 -0
- package/email/forwarding.d.ts +60 -0
- package/email/forwarding.js +57 -0
- package/email/forwarding.js.map +1 -0
- package/email/getMailbox.d.ts +46 -0
- package/email/getMailbox.js +23 -0
- package/email/getMailbox.js.map +1 -0
- package/email/index.d.ts +3 -0
- package/email/index.js +43 -0
- package/email/index.js.map +1 -0
- package/email/mailbox.d.ts +96 -0
- package/email/mailbox.js +66 -0
- package/email/mailbox.js.map +1 -0
- package/index.d.ts +8 -0
- package/index.js +47 -0
- package/index.js.map +1 -0
- package/livedns/domain.d.ts +81 -0
- package/livedns/domain.js +53 -0
- package/livedns/domain.js.map +1 -0
- package/livedns/getDomain.d.ts +34 -0
- package/livedns/getDomain.js +22 -0
- package/livedns/getDomain.js.map +1 -0
- package/livedns/getDomainNameserver.d.ts +38 -0
- package/livedns/getDomainNameserver.js +22 -0
- package/livedns/getDomainNameserver.js.map +1 -0
- package/livedns/index.d.ts +4 -0
- package/livedns/index.js +44 -0
- package/livedns/index.js.map +1 -0
- package/livedns/record.d.ts +116 -0
- package/livedns/record.js +73 -0
- package/livedns/record.js.map +1 -0
- package/package.json +30 -0
- package/package.json.bak +30 -0
- package/provider.d.ts +55 -0
- package/provider.js +51 -0
- package/provider.js.map +1 -0
- package/scripts/install-pulumi-plugin.js +26 -0
- package/simplehosting/index.d.ts +2 -0
- package/simplehosting/index.js +42 -0
- package/simplehosting/index.js.map +1 -0
- package/simplehosting/instance.d.ts +96 -0
- package/simplehosting/instance.js +69 -0
- package/simplehosting/instance.js.map +1 -0
- package/simplehosting/vhost.d.ts +92 -0
- package/simplehosting/vhost.js +63 -0
- package/simplehosting/vhost.js.map +1 -0
- package/types/index.d.ts +3 -0
- package/types/index.js +11 -0
- package/types/index.js.map +1 -0
- package/types/input.d.ts +243 -0
- package/types/input.js +5 -0
- package/types/input.js.map +1 -0
- package/types/output.d.ts +242 -0
- package/types/output.js +5 -0
- package/types/output.js.map +1 -0
- package/utilities.d.ts +4 -0
- package/utilities.js +57 -0
- package/utilities.js.map +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
# Terraform Bridge Provider Boilerplate
|
|
2
|
+
|
|
3
|
+
This repository contains boilerplate code for building a new Pulumi provider which wraps an existing Terraform provider.
|
|
4
|
+
|
|
5
|
+
### Background
|
|
6
|
+
This repository is part of the [guide for authoring and publishing a Pulumi Package](https://www.pulumi.com/docs/guides/pulumi-packages/how-to-author).
|
|
7
|
+
|
|
8
|
+
Learn about the concepts behind [Pulumi Packages](https://www.pulumi.com/docs/guides/pulumi-packages/#pulumi-packages).
|
|
9
|
+
|
|
10
|
+
## Creating a Pulumi Terraform Bridge Provider
|
|
11
|
+
|
|
12
|
+
The following instructions cover:
|
|
13
|
+
- providers maintained by Pulumi (denoted with a "Pulumi Official" checkmark on the Pulumi registry)
|
|
14
|
+
- providers published and maintained by the Pulumi community, referred to as "third-party" providers
|
|
15
|
+
|
|
16
|
+
We showcase a Pulumi-owned provider based on an upstream provider named `terraform-provider-foo`. Substitute appropriate values below for your use case.
|
|
17
|
+
|
|
18
|
+
> Note: If the name of the desired Pulumi provider differs from the name of the Terraform provider, you will need to carefully distinguish between the references - see <https://github.com/pulumi/pulumi-azure> for an example.
|
|
19
|
+
|
|
20
|
+
### Prerequisites
|
|
21
|
+
|
|
22
|
+
Ensure the following tools are installed and present in your `$PATH`:
|
|
23
|
+
|
|
24
|
+
* [`pulumictl`](https://github.com/pulumi/pulumictl#installation)
|
|
25
|
+
* [Go 1.17](https://golang.org/dl/) or 1.latest
|
|
26
|
+
* [NodeJS](https://nodejs.org/en/) 14.x. We recommend using [nvm](https://github.com/nvm-sh/nvm) to manage NodeJS installations.
|
|
27
|
+
* [Yarn](https://yarnpkg.com/)
|
|
28
|
+
* [TypeScript](https://www.typescriptlang.org/)
|
|
29
|
+
* [Python](https://www.python.org/downloads/) (called as `python3`). For recent versions of MacOS, the system-installed version is fine.
|
|
30
|
+
* [.NET](https://dotnet.microsoft.com/download)
|
|
31
|
+
|
|
32
|
+
### Creating and Initializing the Repository
|
|
33
|
+
|
|
34
|
+
Pulumi offers this repository as a [GitHub template repository](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template) for convenience. From this repository:
|
|
35
|
+
|
|
36
|
+
1. Click "Use this template".
|
|
37
|
+
1. Set the following options:
|
|
38
|
+
* Owner: pulumi (third-party: your GitHub organization/username)
|
|
39
|
+
* Repository name: pulumi-foo (third-party: preface your repo name with "pulumi" as standard practice)
|
|
40
|
+
* Description: Pulumi provider for Foo
|
|
41
|
+
* Repository type: Public
|
|
42
|
+
1. Clone the generated repository.
|
|
43
|
+
|
|
44
|
+
From the templated repository:
|
|
45
|
+
|
|
46
|
+
1. Run the following command to update files to use the name of your provider (third-party: use your GitHub organization/username):
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
make prepare NAME=foo REPOSITORY=github.com/pulumi/pulumi-foo
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
This will do the following:
|
|
53
|
+
- rename folders in `provider/cmd` to `pulumi-resource-foo` and `pulumi-tfgen-foo`
|
|
54
|
+
- replace dependencies in `provider/go.mod` to reflect your repository name
|
|
55
|
+
- find and replace all instances of the boilerplate `gandi` with the `NAME` of your provider.
|
|
56
|
+
|
|
57
|
+
Note for third-party providers:
|
|
58
|
+
- Make sure to set the correct GitHub organization/username in all files referencing your provider as a dependency:
|
|
59
|
+
- `examples/go.mod`
|
|
60
|
+
- `provider/resources.go`
|
|
61
|
+
- `sdk/go.mod`
|
|
62
|
+
- `provider/cmd/pulumi-resource-foo/main.go`
|
|
63
|
+
- `provider/cmd/pulumi-tfgen-foo/main.go`
|
|
64
|
+
|
|
65
|
+
2. Modify `README-PROVIDER.md` to include the following (we'll rename it to `README.md` toward the end of this guide):
|
|
66
|
+
* Any desired build status badges.
|
|
67
|
+
* An introductory paragraph describing the type of resources the provider manages, e.g. "The Foo provider for Pulumi manages resources for [Foo](http://example.com/).
|
|
68
|
+
* In the "Installing" section, correct package names for the various SDK libraries in the languages Pulumi supports.
|
|
69
|
+
* In the "Configuration" section, any configurable options for the provider. These may include, but are not limited to, environment variables or options that can be set via [`pulumi config set`](https://www.pulumi.com/docs/reference/cli/pulumi_config_set/).
|
|
70
|
+
* In the "Reference" section, provide a link to the to-be-published documentation.
|
|
71
|
+
* Feel free to refer to [the Pulumi AWS provider README](https://github.com/pulumi/pulumi-aws) as an example.
|
|
72
|
+
|
|
73
|
+
### Composing the Provider Code - Prerequisites
|
|
74
|
+
|
|
75
|
+
Pulumi provider repositories have the following general structure:
|
|
76
|
+
|
|
77
|
+
* `examples/` contains sample code which may optionally be included as integration tests to be run as part of a CI/CD pipeline.
|
|
78
|
+
* `provider/` contains the Go code used to create the provider as well as generate the SDKs in the various languages that Pulumi supports.
|
|
79
|
+
* `provider/cmd/pulumi-tfgen-foo` generates the Pulumi resource schema (`schema.json`), based on the Terraform provider's resources.
|
|
80
|
+
* `provider/cmd/pulumi-resource-foo` generates the SDKs in all supported languages from the schema, placing them in the `sdk/` folder.
|
|
81
|
+
* `provider/pkg/resources.go` is the location where we will define the Terraform-to-Pulumi mappings for resources.
|
|
82
|
+
* `sdk/` contains the generated SDK code for each of the language platforms that Pulumi supports, with each supported platform in a separate subfolder.
|
|
83
|
+
|
|
84
|
+
1. In `provider/go.mod`, add a reference to the upstream Terraform provider in the `require` section, e.g.
|
|
85
|
+
|
|
86
|
+
```go
|
|
87
|
+
github.com/foo/terraform-provider-foo v0.4.0
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
1. In `provider/resources.go`, ensure the reference in the `import` section uses the correct Go module path, e.g.:
|
|
91
|
+
|
|
92
|
+
```go
|
|
93
|
+
github.com/foo/terraform-provider-foo/foo
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
1. Download the dependencies:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
cd provider && go mod tidy && cd -
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
1. Create the schema by running the following command:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
make tfgen
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Note warnings about unmapped resources and data sources in the command's output. We map these in the next section, e.g.:
|
|
109
|
+
|
|
110
|
+
```text
|
|
111
|
+
warning: resource foo_something not found in provider map; skipping
|
|
112
|
+
warning: resource foo_something_else not found in provider map; skipping
|
|
113
|
+
warning: data source foo_something not found in provider map; skipping
|
|
114
|
+
warning: data source foo_something_else not found in provider map; skipping
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Adding Mappings, Building the Provider and SDKs
|
|
118
|
+
|
|
119
|
+
In this section we will add the mappings that allow the interoperation between the Pulumi provider and the Terraform provider. Terraform resources map to an identically named concept in Pulumi. Terraform data sources map to plain old functions in your supported programming language of choice. Pulumi also allows provider functions and resources to be grouped into _namespaces_ to improve the cohesion of a provider's code, thereby making it easier for developers to use. If your provider has a large number of resources, consider using namespaces to improve usability.
|
|
120
|
+
|
|
121
|
+
The following instructions all pertain to `provider/resources.go`, in the section of the code where we construct a `tfbridge.ProviderInfo` object:
|
|
122
|
+
|
|
123
|
+
1. **Add resource mappings:** For each resource in the provider, add an entry in the `Resources` property of the `tfbridge.ProviderInfo`, e.g.:
|
|
124
|
+
|
|
125
|
+
```go
|
|
126
|
+
// Most providers will have all resources (and data sources) in the main module.
|
|
127
|
+
// Note the mapping from snake_case HCL naming conventions to UpperCamelCase Pulumi SDK naming conventions.
|
|
128
|
+
// The name of the provider is omitted from the mapped name due to the presence of namespaces in all supported Pulumi languages.
|
|
129
|
+
"foo_something": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "Something")},
|
|
130
|
+
"foo_something_else": {Tok: tfbridge.MakeResource(mainPkg, mainMod, "SomethingElse")},
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
1. **Add CSharpName (if necessary):** Dotnet does not allow for fields named the same as the enclosing type, which sometimes results in errors during the dotnet SDK build.
|
|
134
|
+
If you see something like
|
|
135
|
+
```text
|
|
136
|
+
error CS0542: 'ApiKey': member names cannot be the same as their enclosing type [/Users/guin/go/src/github.com/pulumi/pulumi-artifactory/sdk/dotnet/Pulumi.Artifactory.csproj]
|
|
137
|
+
```
|
|
138
|
+
you'll want to give your Resource a CSharpName, which can have any value that makes sense:
|
|
139
|
+
|
|
140
|
+
```go
|
|
141
|
+
"foo_something_dotnet": {
|
|
142
|
+
Tok: tfbridge.MakeResource(mainPkg, mainMod, "SomethingDotnet"),
|
|
143
|
+
Fields: map[string]*tfbridge.SchemaInfo{
|
|
144
|
+
"something_dotnet": {
|
|
145
|
+
CSharpName: "SpecialName",
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
[See the underlying terraform-bridge code here.](https://github.com/pulumi/pulumi-terraform-bridge/blob/master/pkg/tfbridge/info.go#L168)
|
|
152
|
+
1. **Add data source mappings:** For each data source in the provider, add an entry in the `DataSources` property of the `tfbridge.ProviderInfo`, e.g.:
|
|
153
|
+
|
|
154
|
+
```go
|
|
155
|
+
// Note the 'get' prefix for data sources
|
|
156
|
+
"foo_something": {Tok: tfbridge.MakeDataSource(mainPkg, mainMod, "getSomething")},
|
|
157
|
+
"foo_something_else": {Tok: tfbridge.MakeDataSource(mainPkg, mainMod, "getSomethingElse")},
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
1. **Add documentation mapping (sometimes needed):** If the upstream provider's repo is not a part of the `terraform-providers` GitHub organization, specify the `GitHubOrg` property of `tfbridge.ProviderInfo` to ensure that documentation is picked up by the codegen process, and that attribution for the upstream provider is correct, e.g.:
|
|
161
|
+
|
|
162
|
+
```go
|
|
163
|
+
GitHubOrg: "foo",
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
1. **Add provider configuration overrides (not typically needed):** Pulumi's Terraform bridge automatically detects configuration options for the upstream provider. However, in rare cases these settings may need to be overridden, e.g. if we want to change an environment variable default from `API_KEY` to `FOO_API_KEY`. Examples of common uses cases:
|
|
167
|
+
|
|
168
|
+
```go
|
|
169
|
+
"additional_required_parameter": {},
|
|
170
|
+
"additional_optional_string_parameter": {
|
|
171
|
+
Default: &tfbridge.DefaultInfo{
|
|
172
|
+
Value: "default_value",
|
|
173
|
+
},
|
|
174
|
+
"additional_optional_boolean_parameter": {
|
|
175
|
+
Default: &tfbridge.DefaultInfo{
|
|
176
|
+
Value: true,
|
|
177
|
+
},
|
|
178
|
+
// Renamed environment variables can be accounted for like so:
|
|
179
|
+
"apikey": {
|
|
180
|
+
Default: &tfbridge.DefaultInfo{
|
|
181
|
+
EnvVars: []string{"FOO_API_KEY"},
|
|
182
|
+
},
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
1. Build the provider binary and ensure there are no warnings about unmapped resources and no warnings about unmapped data sources:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
make provider
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
You may see warnings about documentation and examples, including "unexpected code snippets". These can be safely ignored for now. Pulumi will add additional documentation on mapping docs in a future revision of this guide.
|
|
192
|
+
|
|
193
|
+
1. Build the SDKs in the various languages Pulumi supports:
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
make build_sdks
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
1. Ensure the Golang SDK is a proper go module:
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
cd sdk && go mod tidy && cd -
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
This will pull in the correct dependencies in `sdk/go.mod` as well as setting the dependency tree in `sdk/go.sum`.
|
|
206
|
+
|
|
207
|
+
1. Finally, ensure the provider code conforms to Go standards:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
make lint_provider
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Fix any issues found by the linter.
|
|
214
|
+
|
|
215
|
+
**Note:** If you make revisions to code in `resources.go`, you must re-run the `make tfgen` target to regenerate the schema.
|
|
216
|
+
The `make tfgen` target will take the file `schema.json` and serialize it to a byte array so that it can be included in the build output.
|
|
217
|
+
(This is a holdover from Go 1.16, which does not have the ability to directly embed text files. We are working on removing the need for this step.)
|
|
218
|
+
|
|
219
|
+
## Sample Program
|
|
220
|
+
|
|
221
|
+
In this section, we will create a Pulumi program in TypeScript that utilizes the provider we created to ensure everything is working properly.
|
|
222
|
+
|
|
223
|
+
1. Create an account with the provider's service and generate any necessary credentials, e.g. API keys.
|
|
224
|
+
* Email: bot@pulumi.com
|
|
225
|
+
* Password: (Create a random password in 1Password with the maximum length and complexity allowed by the provider.)
|
|
226
|
+
* Ensure all secrets (passwords, generated API keys) are stored in Pulumi's 1Password vault.
|
|
227
|
+
|
|
228
|
+
1. Copy the `pulumi-resource-foo` binary generated by `make provider` and place it in your `$PATH` (`$GOPATH/bin` is a convenient choice), e.g.:
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
cp bin/pulumi-resource-foo $GOPATH/bin
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
1. Tell Yarn to use your local copy of the SDK:
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
make install_nodejs_sdk
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
1. Create a new Pulumi program in the `examples/` directory, e.g.:
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
mkdir examples/my-example/ts # Change "my-example" to something more meaningful.
|
|
244
|
+
cd examples/my-example/ts
|
|
245
|
+
pulumi new typescript
|
|
246
|
+
# (Go through the prompts with the default values)
|
|
247
|
+
npm install
|
|
248
|
+
yarn link @pulumi/foo
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
1. Create a minimal program for the provider, i.e. one that creates the smallest-footprint resource. Place this code in `index.ts`.
|
|
252
|
+
1. Configure any necessary environment variables for authentication, e.g `$FOO_USERNAME`, `$FOO_TOKEN`, in your local environment.
|
|
253
|
+
1. Ensure the program runs successfully via `pulumi up`.
|
|
254
|
+
1. Once the program completes successfully, verify the resource was created in the provider's UI.
|
|
255
|
+
1. Destroy any resources created by the program via `pulumi destroy`.
|
|
256
|
+
|
|
257
|
+
Optionally, you may create additional examples for SDKs in other languages supported by Pulumi:
|
|
258
|
+
|
|
259
|
+
1. Python:
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
mkdir examples/my-example/py
|
|
263
|
+
cd examples/my-example/py
|
|
264
|
+
pulumi new python
|
|
265
|
+
# (Go through the prompts with the default values)
|
|
266
|
+
source venv/bin/activate # use the virtual Python env that Pulumi sets up for you
|
|
267
|
+
pip install pulumi_foo
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
1. Follow the steps above to verify the program runs successfully.
|
|
271
|
+
|
|
272
|
+
## Add End-to-end Testing
|
|
273
|
+
|
|
274
|
+
We can run integration tests on our examples using the `*_test.go` files in the `examples/` folder.
|
|
275
|
+
|
|
276
|
+
1. Add code to `examples_nodejs_test.go` to call the example you created, e.g.:
|
|
277
|
+
|
|
278
|
+
```go
|
|
279
|
+
// Swap out MyExample and "my-example" below with the name of your integration test.
|
|
280
|
+
func TestAccMyExampleTs(t *testing.T) {
|
|
281
|
+
test := getJSBaseOptions(t).
|
|
282
|
+
With(integration.ProgramTestOptions{
|
|
283
|
+
Dir: filepath.Join(getCwd(t), "my-example", "ts"),
|
|
284
|
+
})
|
|
285
|
+
integration.ProgramTest(t, &test)
|
|
286
|
+
}
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
1. Add a similar function for each example that you want to run in an integration test. For examples written in other languages, create similar files for `examples_${LANGUAGE}_test.go`.
|
|
290
|
+
|
|
291
|
+
1. You can run these tests locally via Make:
|
|
292
|
+
|
|
293
|
+
```bash
|
|
294
|
+
make test
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
You can also run each test file separately via test tags:
|
|
298
|
+
|
|
299
|
+
```bash
|
|
300
|
+
cd examples && go test -v -tags=nodejs
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
## Configuring CI with GitHub Actions
|
|
304
|
+
|
|
305
|
+
### Third-party providers
|
|
306
|
+
|
|
307
|
+
1. Follow the instructions laid out in the [deployment templates](./deployment-templates/README-DEPLOYMENT.md).
|
|
308
|
+
|
|
309
|
+
### Pulumi Internal
|
|
310
|
+
|
|
311
|
+
In this section, we'll add the necessary configuration to work with GitHub Actions for Pulumi's standard CI/CD workflows for providers.
|
|
312
|
+
|
|
313
|
+
1. Generate GitHub workflows per [the instructions in the ci-mgmt repository](https://github.com/pulumi/ci-mgmt/) and copy to `.github/` in this repository.
|
|
314
|
+
|
|
315
|
+
1. Ensure that any required secrets are present as repository-level [secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets) in GitHub. These will be used by the integration tests during the CI/CD process.
|
|
316
|
+
|
|
317
|
+
1. Repository settings: Toggle `Allow auto-merge` on in your provider repo to automate GitHub Actions workflow updates.
|
|
318
|
+
|
|
319
|
+
## Final Steps
|
|
320
|
+
|
|
321
|
+
1. Ensure all required configurations (API keys, etc.) are documented in README-PROVIDER.md.
|
|
322
|
+
|
|
323
|
+
1. Replace this file with the README for the provider and push your changes:
|
|
324
|
+
|
|
325
|
+
```bash
|
|
326
|
+
mv README-PROVIDER.md README.md
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
1. If publishing the npm package fails during the "Publish SDKs" Action, perform the following steps:
|
|
330
|
+
1. Go to [NPM Packages](https://www.npmjs.com/) and sign in as pulumi-bot.
|
|
331
|
+
1. Click on the bot's profile pic and navigate to "Packages".
|
|
332
|
+
1. On the left, under "Organizations, click on the Pulumi organization.
|
|
333
|
+
1. On the last page of the listed packages, you should see the new package.
|
|
334
|
+
1. Under "Settings", set the Package Status to "public".
|
|
335
|
+
|
|
336
|
+
Now you are ready to use the provider, cut releases, and have some well-deserved :ice_cream:!
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
## Building the Provider Locally
|
|
340
|
+
|
|
341
|
+
There are 2 ways the provider can be built locally:
|
|
342
|
+
|
|
343
|
+
`make provider` will use the current operating system and architecture to create a binary that can be used on your PATH.
|
|
344
|
+
|
|
345
|
+
To build the provider for another set of operating systems / architectures, the project uses [goreleaser](https://goreleaser.com/).
|
|
346
|
+
Goreleaser, a CLI tool, that allows a user to build a matrix of binaries.
|
|
347
|
+
|
|
348
|
+
Create a `.goreleaser.yml` file in the root of your project:
|
|
349
|
+
```
|
|
350
|
+
archives:
|
|
351
|
+
- id: archive
|
|
352
|
+
name_template: "{{ .Binary }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}"
|
|
353
|
+
before:
|
|
354
|
+
hooks:
|
|
355
|
+
- make tfgen
|
|
356
|
+
builds:
|
|
357
|
+
- binary: pulumi-resource-gandi
|
|
358
|
+
dir: provider
|
|
359
|
+
goarch:
|
|
360
|
+
- amd64
|
|
361
|
+
- arm64
|
|
362
|
+
goos:
|
|
363
|
+
- darwin
|
|
364
|
+
- windows
|
|
365
|
+
- linux
|
|
366
|
+
ignore: []
|
|
367
|
+
ldflags:
|
|
368
|
+
- -X github.com/pulumiverse/pulumi-gandi/provider/pkg/version.Version={{.Tag}}
|
|
369
|
+
main: ./cmd/pulumi-resource-gandi/
|
|
370
|
+
sort: asc
|
|
371
|
+
use: git
|
|
372
|
+
release:
|
|
373
|
+
disable: false
|
|
374
|
+
snapshot:
|
|
375
|
+
name_template: "{{ .Tag }}-SNAPSHOT"
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
To build the provider for the combination of architectures and operating systems, you can run the following CLI command:
|
|
379
|
+
|
|
380
|
+
```bash
|
|
381
|
+
goreleaser build --rm-dist --skip-validate
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
That will ensure that a list of binaries are available to use:
|
|
385
|
+
|
|
386
|
+
```
|
|
387
|
+
▶ tree dist
|
|
388
|
+
dist
|
|
389
|
+
├── CHANGELOG.md
|
|
390
|
+
├── artifacts.json
|
|
391
|
+
├── config.yaml
|
|
392
|
+
├── metadata.json
|
|
393
|
+
├── pulumi-gandi_darwin_amd64_v1
|
|
394
|
+
│ └── pulumi-resource-gandi
|
|
395
|
+
├── pulumi-gandi_darwin_arm64
|
|
396
|
+
│ └── pulumi-resource-gandi
|
|
397
|
+
├── pulumi-gandi_linux_amd64_v1
|
|
398
|
+
│ └── pulumi-resource-gandi
|
|
399
|
+
├── pulumi-gandi_linux_arm64
|
|
400
|
+
│ └── pulumi-resource-gandi
|
|
401
|
+
├── pulumi-gandi_windows_amd64_v1
|
|
402
|
+
│ └── pulumi-resource-gandi.exe
|
|
403
|
+
└── pulumi-gandi_windows_arm64
|
|
404
|
+
└── pulumi-resource-gandi.exe
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
Any of the provider binaries can be used to target the correct machine architecture
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./vars";
|
package/config/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
|
|
3
|
+
// *** Do not edit by hand unless you're certain you know what you are doing! ***
|
|
4
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5
|
+
if (k2 === undefined) k2 = k;
|
|
6
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
7
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
8
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
9
|
+
}
|
|
10
|
+
Object.defineProperty(o, k2, desc);
|
|
11
|
+
}) : (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
o[k2] = m[k];
|
|
14
|
+
}));
|
|
15
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
16
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
17
|
+
};
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
// Export members:
|
|
20
|
+
__exportStar(require("./vars"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../config/index.ts"],"names":[],"mappings":";AAAA,wFAAwF;AACxF,iFAAiF;;;;;;;;;;;;;;;;AAEjF,kBAAkB;AAClB,yCAAuB"}
|
package/config/vars.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prevent the Domain provider from taking certain actions
|
|
3
|
+
*/
|
|
4
|
+
export declare const dryRun: boolean | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* A Gandi API key
|
|
7
|
+
*/
|
|
8
|
+
export declare const key: string | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* A Gandi Sharing ID
|
|
11
|
+
*/
|
|
12
|
+
export declare const sharingId: string | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* The Gandi API URL
|
|
15
|
+
*/
|
|
16
|
+
export declare const url: string | undefined;
|