crossplane-contrib / provider-terraform

A @crossplane provider for Terraform
Apache License 2.0
94 stars 28 forks source link

vars should be able to take non-flat values #151

Open bhavinkotak opened 1 year ago

bhavinkotak commented 1 year ago

What happened?

Usecase: We are trying to create EKS Cluster using Crossplane and to create multiple Node-groups/launch-templates we are using terraform-provider to dynamically read the details from the claim.yaml

claim.yaml

kind: ManagedCluster
metadata:
  namespace: crossplane-system
  name: eks-cluster
parameters:
    region: us-east-2
    version: "1.21"
    nodeRole: arn:aws:iam::xxxxx:role/eksNodeRole
    nodeGroups:
      - desiredSize: 2
        maxSize: 2
        minSize: 2
        instanceType: m5.4xlarge
        label: fruit=apple
        volumeSize: 150
      - desiredSize: 1
        maxSize: 1
        minSize: 1
        instanceType: m5.4xlarge
        label: fruit=banana
        volumeSize: 80

As per current behavior, terraform-provider gives 2 options to pass variables - vars & varFiles.

varFiles supports data in HCL or JSON format. vars support data in plain string - flat values only.

What environment did it happen in?

Crossplane version: 1.10.1 provider-terraform: 0.2.0 Kubernetes: 1.23

Solution could be to enhance vars to take non-flat values as input & internally convert to HCL/JSON to pass to terraform-provider.

ytsarev commented 1 year ago

Thanks a lot for the report! Marking it as an enhancement as it extends the original basic implementation.

bobh66 commented 1 year ago

This should probably be moved to the upbound/provider-terraform repo

bhavinkotak commented 1 year ago

Moved to upbound/provider-terraform - https://github.com/upbound/provider-terraform/issues/45