Skip to content
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

Auto-generate wiz.io/hashicorp/terraform-provider-wiz/internal/vendor #53

Open
gramsa49 opened this issue Dec 14, 2022 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@gramsa49
Copy link
Collaborator

gramsa49 commented Dec 14, 2022

Description

The vendor's GraphQL schema is large and changes frequently. This requires maintenance in golang package wiz.io/hashicorp/terraform-provider-wiz/internal/vendor.

Devise a method/solution to auto-generate "wiz.io/hashicorp/terraform-provider-wiz/internal/vendor" based on "schema/wiz.graphql".

The solution will have to account for exceptions in the GraphQL schema that cannot be mirrored properly in golang. As one reference, take the updateProject mutation:

type Mutation {
  updateProject(input: UpdateProjectInput!): UpdateProjectPayload!

The mutation takes varaibles UpdateProjectInput:

input UpdateProjectInput {
  id: ID!
  patch: UpdateProjectPatch
  override: UpdateProjectPatch
}

input UpdateProjectPatch {
  name: String
  description: String
  identifiers: [String!]
  businessUnit: String
  archived: Boolean
  projectOwners: [String!]
  securityChampions: [String!]
  riskProfile: ProjectRiskProfileInput
  repositoryLinks: [ProjectRepositoryLinkInput!]
  cloudAccountLinks: [ProjectCloudAccountLinkInput!]
  cloudOrganizationLinks: [ProjectCloudOrganizationLinkInput!]
  kubernetesClusterLinks: [ProjectKubernetesClusterLinkInput!]
}

Fields such as businessUnit are optional. These structs are represented in golang with the json tag omitempty. If the value of the businessUnit is removed in the Terraform HCL, the value will not be passed in the request, which will not update the value to null. An override was necessary to leave out the omitempty json tag from the golang struct.

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant