-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Story: Using terraform resources in Wing code #489
Comments
Added "use cases" with some thoughts. |
Random terraform-specific technical detail - when you import a GitHub resource, I believe a Need to double check how this works in practice - if I can just call (misc: we might also want some mechanism to "hide" some constructs from the tree view by default? kind of like how dotfiles are hidden in your file explorer initially?) |
@Chriscbr good point about Terraform providers. When the provider doesn't take have any required props, we can implicitly add it to the stack as needed, but the question is what happens when there are some required options, or when users want to configure anything there. It feels like this falls somewhere under the infrastructure policy area, so its basically some kind of HCL that can be merged into the output: provider "github" {
app_auth {}
} And then: $ wing compile hello.w --with my-policy.hcl (
Actually just talked about this with @ainvoner, @skyrpex and @polamoros that we want to start adding some annotations to constructs to improve the way they look and feel in the Wing Console. I'll create an issue to start the conversation. |
Hi, This issue hasn't seen activity in 60 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. |
@Chriscbr I believe this is done, right? |
Yep, I think the rest of the use cases (like how to override a terraform resource with a simulator implementation) is addressed by #1365 |
Summary
Seamlessly use arbitrary Terraform resources in Wing
Feature Spec
You can use any resource from the vast Terraform Registry in your Wing applications.
Let's walk through an example. We will use the pre-built CDKTF provider for GitHub called @cdktf/provider-github.
First, let's install the provider module:
Now,
bring
this into your code and define aRepository
resource:This is all dandy. If we compile our code to a Terraform target (such as
tfaws
), this should Just Work™️:The Terraform output will includes:
But what happens when we try to compile this to the
sim
target?This error indicates that I need to inject a
sim
backend for this resource through a TypeScript factory:OK, let's create one:
// TO BE CONTINUNED
Use Cases
P0 is to simply support terraform resources when compiling to terraform (perhaps this is already supported? Worth adding a test/example...
Next, we should figure out what happens when we set the target to
sim
. I suspect that this will simply cause theTerraformResource
to emit an error saying it couldn't find theTerraformStack
scope, isn't it?So now, what do we do?
Users may want different solutions to this situation:
sim
, my output will include a terraform output which the Wing Console (??) will be able to apply when it's starting and the local resources will be wired into the cloud resources. This is a holy grail worth perusing because its the reality of the cloud...Implementation Notes
No response
Component
No response
The text was updated successfully, but these errors were encountered: