-
Notifications
You must be signed in to change notification settings - Fork 97
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
[Discussion] Optional recipe context attributes in TF module config and Recipe versioning #6306
Comments
So does this go in the generated wrapper module? I'm trying to understand from bug whether this is about:
If it's an implementation detail of Radius are there any downsides to option 1? Channeling my inner language designer here: I would strongly prefer using the type system over using sentinel values as a workaround. |
Does
Actually, I tried option 1 and 2. Apart from the downsides above in option 2, populating empty properties give user the wrong impression like a bug. so I prefer option 1 too. |
I think there is room for confusion in how the problem and solutions are phrased. Adding optional field in this test file https://github.com/project-radius/radius/blob/a2d1ebe786aee71e2bf4215e0e3daf5671e6ae1d/pkg/recipes/terraform/testdata/.terraform/modules/test-module-recipe-context/variables.tf will not fix real user scenario. In real scenario this file is controlled by the user in the module/module wrapper they are using as a Recipe, so to support option 1, we are expecting that we can require users to always mark certain fields as optional which is not realistic. As I mentioned on the PR, Terraform does not throw an error if certain fields are not defined at all but are passed - so if
@rynowak This is not controlled by Radius. |
Just to be clear - I am pretty new to TF work so my question could be irrelevant or already discussed. I am still learning our TF design/implementation, so I might have the missing discussion or conversation. But I still don't understand why
From what I understand from Ryan's comment, there are two personas:
We do not have the full-control for the first one even though they will follow Working on my first PR for TF work, my initial thought was that we would provide the sharable TF file which included recipe context schema, so recipe authors would just copy the sharable TF file to their TF recipe instead of authoring context variable by themselves. @kachawla Based on your comment, is your expectation that we will guide TF recipe author that user would define only what they use in their module? In bicep template, we don't define the entire recipe schema, which is free-form style object. But I thought I must define the exact schema for TF in the beginning. I learn today that TF also has variable "context" {
description = "This variable contains Radius recipe context."
type = any
} |
@youngbupark , @kachawla - did we have the information needed here on this issue , any action item to be taken on this issue? |
👍 We've reviewed this issue and have agreed to add it to our backlog. Please subscribe to this issue for notifications, we'll provide updates when we pick it up. We also welcome community contributions! If you would like to pick this item up sooner and submit a pull request, please visit our contribution guidelines and assign this to yourself by commenting "/assign" on this issue. For more information on our triage process please visit our triage overview |
triage: need to have more discussion on this and decide on the priority. |
The reason why I mentioned it not being realistic is, because we don't control what users define in their variables.tf file, we can give them guidance to mark azure/aws attributes as optional since they will not be passed if not configured, but we can't enforce this since Radius doesn't have control over it.
This is what we have documented in the recipe authoring page https://docs.radapp.io/guides/recipes/howto-author-recipes/ |
Problem
In PR #5999, we support recipe context in Terraform module config. User's recipe TF module should contain the following
context
variable. We found that TF threw the error if Radius didn't provide one of the attributes in module json config.We found
attributes \"aws\" and \"azure\"\nare required.
error in the functional test because Radius didn't setaws
andazure
in module config. Terraform providesoptional
keyword for such optional attributes. In PR #5999, we add optional keyword toazure
andaws
objects to address the problem.Functional test log - https://github.com/project-radius/radius/actions/runs/5774669455/job/15651905021
Possible solutions
Option 1
In PR #5999 , I added
optional
keyword to makeazure
andaws
optional. So terraform will ignore the properties.Option 2
We don't add any optional keyword to attributes but instead, Radius can pass empty properties like below.
However, this will still cause the same problem when we introduce new attributes in recipe context.
Let's say there are User 1 and User 2.
User 1 uses Radius v0.30.0 and context v2 schema which includes new
gcp
attribute and publish it to the module repository.User 2 uses Radius v0.20.0 and context v1 schema which doesn't contain
gcp
attribute and try to use User 1's module.And then User 2 will face the same problem because Radius v0.20.0 would not populate
gcp
.Other questions
AB#8905
AB#9511
AB#10014
The text was updated successfully, but these errors were encountered: