aptible / terraform-provider-aptible

The official Terraform provider for Aptible Deploy
https://registry.terraform.io/providers/aptible/aptible/latest
10 stars 13 forks source link

fix: added inference of organization id for environment resource proof #88

Closed madhuravius closed 1 year ago

madhuravius commented 1 year ago

TODOS:

✅ Manual test case 1: orgid can be inferred from dedicated stack (had to force my stack to be private and assigned an org id via rails console) ✅ Manual test case 2: orgid can be inferred from user ✅ Manual test case 3: orgid must be specific explicitly, because above two conditions not met

Manual test case 3: orgid must be specific explicitly, because above two conditions not met

image

I hit this error block as expected when no conditions were met:

I used the below terraform:

terraform {
  required_providers {
    aptible = {
      source  = "aptible.com/aptible/aptible"
    }
  }
}

data "aptible_stack" "stack" {
  name = var.stack_name
}

resource "aptible_environment" "example" {
  handle = "test_environment_123456"
  stack_id = data.aptible_stack.stack.stack_id
}

The above case is fine if provided manually:

image
shortcut-integration[bot] commented 1 year ago

This pull request has been linked to Shortcut Story #7097: Calculate organization ID for Environments.

madhuravius commented 1 year ago

Inferred from user (non dedicated stack):

image image image

Inferred from stack (dedicated stack), had to disable auth api endpoint to verify:

image image image
madhuravius commented 1 year ago

The new test case passes for me locally but may not pass in CI unless there are specific conditions met (user is part of one org OR is dedicated stack)

image