swift-rocket-90720
07/05/2024, 1:03 PMproviders
directory. For example, in Terraform and CF, the AWS code for DynamoDB seems to be doing pretty much the same thing, which is the extraction of information from the resource data.
Another example where we noticed this case of duplication is in the repository that is focused on adding support for Pulumi. The only thing that is different between all these functions is the string being passed to the Get function (CF isn't using the Get function, but it could be modified to do so) (https://github.com/rshade/infracost/blob/feat/pulumi/internal/providers/pulumi/aws/dynamodb_table.go)
Therefore, we figured we could probably try to refactor the code first to reduce duplication and implementation, and increase scalability when it comes to adding new IaC tools. We would love to have a discussion with you regarding our solution and get your feedback before we open the PR, to ensure we go it the right way.mysterious-teacher-68276
07/05/2024, 1:15 PMHowever, we don’t want to contribute this solution directly.So are you adding ARM support to a private fork or something you will maintain yourself?
For example, in Terraform and CF, the AWS code for DynamoDB seems to be doing pretty much the same thing, which is the extraction of information from the resource data.Yes that is correct the providers logic is essentially a mapping layer
The only thing that is different between all these functions is the string being passed to the Get function (CF isn’t using the Get function, but it could be modified to do so)In general we have not focused on generalising the providers layer because we are fully focused on Terraform support for now. So it has not been a priority to refactor/rework the mapping layer as we only really support Terraform (cloudformation is only barely supported)
We would love to have a discussion with you regarding our solution and get your feedback before we open the PR.I think the best way to discuss this is probably via a PR to see what you propose.
swift-rocket-90720
07/05/2024, 1:26 PMSo are you adding ARM support to a private fork or something you will maintain yourself?Initially, we did the refactoring part first, then implemented support for ARM. However, we noticed that the PR would be too big as the refactoring part has a lot of file location changes. Therefore, we decided to split this contribution into two separate PRs to make it easier to read and understand.
In general we have not focused on generalising the providers layer because we are fully focused on Terraform support for now. So it has not been a priority to refactor/rework the mapping layer as we only really support Terraform (cloudformation is only barely supported)Our change focuses on generalizing the providers layer, as we have been able to implement a few resources in ARM without having to re-implement the same logic elsewhere for example. There are quite a few details regarding this part, and we are preparing a document that explains the general idea of what we have changed
I think the best way to discuss this is probably via a PR to see what you propose.At the moment, we are not able to provide you with a PR as we are still preparing and finalizing. However, we can provide you with a document, after finalizing it, that explains what we are proposing.
mysterious-teacher-68276
07/05/2024, 2:04 PMswift-rocket-90720
07/05/2024, 2:22 PMmysterious-teacher-68276
07/05/2024, 2:22 PMswift-rocket-90720
07/19/2024, 12:49 PMmysterious-teacher-68276
07/22/2024, 7:29 AMmysterious-teacher-68276
07/22/2024, 7:29 AMswift-rocket-90720
07/22/2024, 7:56 AM