Code Monkey home page Code Monkey logo

Comments (3)

rissson avatar rissson commented on May 31, 2024 1

I see. In that case, I would recommend using blueprints which allow you to manage authentik objects as code directly within authentik.

The included blueprints are available at https://github.com/goauthentik/authentik/tree/main/blueprints and are copied as-is in the container at /blueprints.

For your usecase, you'll need to override https://github.com/goauthentik/authentik/blob/main/blueprints/default/flow-default-authentication-flow.yaml and add a sources attribute to the id: default-authentication-identification item. You'll also need to create the source in another blueprint.

If your other blueprint is called Source - Social and you have a source called social, you can do the following:

# yaml-language-server: $schema=https://goauthentik.io/blueprints/schema.json
---
version: 1
metadata:
  name: Default - Authentication flow
entries:
  # Ensures your source is created before this blueprint is applied
  - model: authentik_blueprints.metaapplyblueprint
    attrs:
      identifiers:
        name: Source - Social
      required: true

  - id: default-authentication-identification
    model: authentik_stages_identification.identificationstage
    identifiers:
      name: default-authentication-identification
    attrs:
      sources:
        - !Find [authentik_core.source, [slug, "authentik-built-in"]]
        - !Find [authentik_core.source, [slug, "social"]]
      show_source_labels: true
      # other attributes omitted for brevity

# other resources that are present in the included blueprint omitted for brevity

We currently don't publish the blueprints we use internally but we plan on creating more resources for users to know what they are, how they work, how to use them and examples based on the documentation provided in https://goauthentik.io/integrations/. Meanwhile, I can direct you to my personal blueprints which should help you as a starting point.

In any case, we won't be modifying the Terraform provider to add that functionality as attaching a source to the identification stage involves modifying the stage itself, which shouldn't be an additional resource. If you still want to go the Terraform route, I recommend you create a new flow instead of the included default one and use that one.

from terraform-provider-authentik.

rissson avatar rissson commented on May 31, 2024

You can have an authentik_stage_identification resource, terraform import it and then make the changes you require to it:

resource "authentik_stage_identification" "default-authentication-identification" {
  name           = "default-authentication-identification"
  user_fields    = ["username", "email"]
  sources        = [authentik_source_oauth.name.uuid] # this needs to exists above somehow
}

And then terraform import authentik_stage_identification.default-authentication-identification <the UUID of the stage (which you can find using the API)>.

And finally terraform apply to make the modifications you need

from terraform-provider-authentik.

NigelVanHattum avatar NigelVanHattum commented on May 31, 2024

Hi @rissson,

Sorry for the somewhat delayed reply, but I did some more trial an error. I would like to manage my whole Authentik deployment & configuration through one single Terraform apply command.

I am deploying my whole cluster, including authentik and all other application via a single command. Using an extra step in this proces to manually import a single resource in order to add an extra IDP to the login screen feels like an oversight.

from terraform-provider-authentik.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.