Skip to content

Question - Need ignore some fields on diff #599

@disaster37

Description

@disaster37

Hi,
I try to implement upjet provider for rancher2.
On ressource rancher_app_v2,the terraform provider update some fields each time (labels and annotations).

So on upjet, it loop on reconciltation because of that.

Wat is the right way to avoid this ?

First
I not found documentation about the purpose of it (I found it on aws-provider)

func Configure(p *config.Provider) {
  p.AddResourceConfigurator("rancher2_app_v2", func(r *config.Resource) {
    r.LateInitializer = config.LateInitializer{
	IgnoredFields: []string{
		"annotations",
		"labels",
	},
    }
  }
}

Second
I not found documentation about the purpose of it (I found it on aws-provider)

func Configure(p *config.Provider) {
	p.AddResourceConfigurator("rancher2_app", func(r *config.Resource) {
                r.TerraformCustomDiff = func(diff *terraform.InstanceDiff, _ *terraform.InstanceState, _ *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
			if diff != nil && diff.Attributes != nil {
				delete(diff.Attributes, "labels.#")
				delete(diff.Attributes, "annotations.#")
			}
			return diff, nil
		}
       }
}

Maybee there are another way ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions