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

initial simplified version of the terraform provider #1

Merged
merged 5 commits into from
Dec 11, 2024
Merged

Conversation

wasaga
Copy link
Collaborator

@wasaga wasaga commented Sep 17, 2024

Related:

given the following terraform:

terraform {
    required_providers {
        pomerium = {
            source = "github.com/pomerium/enterprise-terraform-provider"
            version = "0.0.1"
        }
    }
}

variable "pomerium_service_account_token" {
    type = string
    sensitive = true
}

provider "pomerium" {
    api_url = "https://console-api.localhost.pomerium.io"
    tls_insecure_skip_verify = true
    service_account_token = var.pomerium_service_account_token
}

resource "pomerium_namespace" "test_namespace" {
  name = "test-namespace"
  parent_id = "9d8dbd2c-8cce-4e66-9c1f-c490b4a07243"
}

resource "pomerium_policy" "test_policy" {
  name         = "test-policy"
  namespace_id = pomerium_namespace.test_namespace.id
  ppl          = <<EOF
- allow:
    and:
        - authenticated_user: true
EOF
}

resource "pomerium_route" "test_route" {
  name         = "test-route"
  namespace_id = pomerium_namespace.test_namespace.id
  from         = "https://verify-tf.localhost.pomerium.io"
  to           = ["https://verify.pomerium.com"]
  policies     = [pomerium_policy.test_policy.id]
}
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # pomerium_namespace.test_namespace will be created
  + resource "pomerium_namespace" "test_namespace" {
      + id        = (known after apply)
      + name      = "test-namespace"
      + parent_id = "9d8dbd2c-8cce-4e66-9c1f-c490b4a07243"
    }

  # pomerium_policy.test_policy will be created
  + resource "pomerium_policy" "test_policy" {
      + id           = (known after apply)
      + name         = "test-policy"
      + namespace_id = (known after apply)
      + ppl          = <<-EOT
            - allow:
                and:
                    - authenticated_user: true
        EOT
    }

  # pomerium_route.test_route will be created
  + resource "pomerium_route" "test_route" {
      + from         = "https://verify-tf.localhost.pomerium.io"
      + id           = (known after apply)
      + name         = "test-route"
      + namespace_id = (known after apply)
      + policies     = [
          + (known after apply),
        ]
      + to           = [
          + "https://verify.pomerium.com",
        ]
    }

Plan: 3 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

pomerium_namespace.test_namespace: Creating...
pomerium_namespace.test_namespace: Creation complete after 0s [id=0f075734-e379-4816-a160-e7a3f34abf80]
pomerium_policy.test_policy: Creating...
pomerium_policy.test_policy: Creation complete after 0s [id=45c0c353-7821-4761-8595-fd9559e4319d]
pomerium_route.test_route: Creating...
pomerium_route.test_route: Creation complete after 0s [id=681a7403-fa69-4ee6-adff-e7af8ff52a21]

Apply complete! Resources: 3 added, 0 changed, 0 destroyed.

@wasaga wasaga marked this pull request as ready for review December 10, 2024 22:54
@wasaga wasaga merged commit c4c57d3 into main Dec 11, 2024
2 checks passed
@wasaga wasaga deleted the wasaga/poc branch December 11, 2024 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants