[go: nahoru, domu]

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

Cross-resource references to handle multiple types #350

Open
Tracked by #3393
muvaf opened this issue Aug 30, 2022 · 3 comments
Open
Tracked by #3393

Cross-resource references to handle multiple types #350

muvaf opened this issue Aug 30, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@muvaf
Copy link
Member
muvaf commented Aug 30, 2022

What problem are you facing?

There are fields in some resources that could be fulfilled by different types, i.e. ARN of Instance or NetworkInterface or LoadBalancer could be given. However, cross-resource resolver always works with a singe hard-coded type so you have to use composition to patch those fields.

How could Crossplane help solve your problem?

We could either solve this via generic patching or implement #341 and have per-type resolver logic in the code so that we don't have to ask for fieldpaths, transforms etc.

@muvaf muvaf added the enhancement New feature or request label Aug 30, 2022
@Kerwood
Copy link
Kerwood commented Sep 5, 2022

When creating an Opsgenie Escalation the recipient type can be either user, team or schedule, but Crossplane only supports a single cross-resource reference per "block", in this case rules.recipient.

Below is an example on how it could look like with multi cross-resource reference.

...
spec:
  forProvider:
    name: Escalation Name
    rules:
      - recipient:
          - type: user
            userIdRef:
              name: user-name

          - type: team
            teamIdRef:
              name: team-name

          - type: schedule
            scheduleIdRef:
              name: schedule-name

Terraform example.

resource "opsgenie_escalation" "test" {
  name          = "genieescalation-%s"
  description   = "test"
  owner_team_id = "${opsgenie_team.test.id}"

  rules {
    condition   = "if-not-acked"
    notify_type = "default"
    delay       = 1

    recipient {
      type = "user"
      id   = "${opsgenie_user.test.id}"
    }

    recipient {
      type = "team"
      id   = "${opsgenie_team.test.id}"
    }

    recipient {
      type = "schedule"
      id   = "${opsgenie_schedule.test.id}"
    }
  }

https://registry.terraform.io/providers/opsgenie/opsgenie/latest/docs/resources/escalation

@haarchri
Copy link
Contributor

the same we have in provider-pagerduty

    rule:
    - escalationDelayInMinutes: 10
      target:
      - id: ${pagerduty_user.example.id}
        type: user_reference
      - id: ${pagerduty_user.example2.id}
        type: user_reference

@haarchri
Copy link
Contributor

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

3 participants