-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
azurerm_data_factory_pipeline
- support type for parameters
and variables
#27092
base: main
Are you sure you want to change the base?
azurerm_data_factory_pipeline
- support type for parameters
and variables
#27092
Conversation
Optional: true, | ||
Elem: &pluginsdk.Resource{ | ||
Schema: map[string]*pluginsdk.Schema{ | ||
"name": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a validation func here, the name
should not be empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
Optional: true, | ||
Elem: &pluginsdk.Resource{ | ||
Schema: map[string]*pluginsdk.Schema{ | ||
"name": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a validation func here, the name
should not be empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
variables := make([]interface{}, 0, len(input)) | ||
for k, v := range input { | ||
|
||
// convert value to string if it is bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this only necessary for variable? How about parameters?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the api can do the conversion for parameters but not for variables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, mostly LGTM, just some suggestions, please check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @hqhqhqhqhqhqhqhqhqhqhq. Since we're planning to ship 4.0 this week there isn't any need to use the feature flag. If you can make those changes quickly I think we can get this in just before we release this week. If you think you'll be unable to make the deadline then please follow the guidance I left in the comment in-line using the feature flag for the next major release features.FivePointOhBeta
.
@@ -109,6 +110,69 @@ func resourceDataFactoryPipeline() *pluginsdk.Resource { | |||
}, | |||
}, | |||
} | |||
|
|||
if features.FourPointOhBeta() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For future reference, these types of schema changes should use the inverted feature flag e.g.
schema: map[string]*pluginsdk.Schema{
// We put the desired breaking schema changes in here
}
if !features.FourPointOhBeta {
// We patch over the breaking schema change with the old definition here
}
This makes cleaning up old/deprecated code post major release much easier since the only action is to delete the entire block wrapped in the !features.FourPointOhBeta
flag instead of having to copy paste the new behaviour into the schema above.
However.. since we're planning to ship 4.0 this week there isn't any need for the flag at all, this is an exceptional week where you can go ahead and make the breaking change directly in the schema and it would be acceptable and fine to merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stephybun thanks for above.
Not relevant to the change required. Wanted to check what's the best practice to ensure the order is not checked when it comes to running terraform plan
, e.g. I have made parameters
a list of objects, when multiple paramters
are declared, running plan will have diffs because of the order.
Looks like changing to TypeSet fix the problem, but not sure I should use TypeSet over TypeList.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hqhqhqhqhqhqhqhqhqhqhq it seems like the API doesn't preserve the order of the parameters, so we won't have any other choice but to use a Set here
Just found that another resource resource "azurerm_data_factory_trigger_schedule" "test" {
name = "acctestdf%[1]d"
data_factory_id = azurerm_data_factory.test.id
pipeline {
name = azurerm_data_factory_pipeline.test1.name
parameters = azurerm_data_factory_pipeline.test1.parameters
}
pipeline {
name = azurerm_data_factory_pipeline.test2.name
parameters = azurerm_data_factory_pipeline.test2.parameters
}
annotations = ["test1", "test2", "test3"]
} It is referencing I checked the api for I wonder whether I should change the schema for |
Changing the schema for the trigger schedule will be more complicated than it has been for the pipeline since whatever we define in the schema will need to be transformed to and from a generic map. Given how close we are to the major release I'm leaning towards leaving this as is for now and to potentially do this as a soft deprecation post 4.0. |
Thanks, have updated the doc & tests, ready for review now. |
Community Note
Description
Support type for
parameters
andvariables
for resourceazurerm_data_factory_pipeline
.Example usage:
The API can handle the conversion from string default_value to the specified type. However it does not currently work for type being
Bool
forVariables
(create new variable withtype
asBool
, it will still show up as a String value in Azure Data Factory), hence theBool
type is not currently added in validatefunc forVariables
'sType
property.PR Checklist
For example: “
resource_name_here
- description of change e.g. adding propertynew_property_name_here
”Changes to existing Resource / Data Source
Testing
Change Log
Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.
azurerm_data_factory_pipeline
- support type forparameters
andvariables
This is a (please select all that apply):
Related Issue(s)
Feature request: #13131
Note
If this PR changes meaningfully during the course of review please update the title and description as required.