Skip to content

Can not create an organization without default_environment#3

Closed
quentinleclerc wants to merge 1 commit intojosh-silvas:mainfrom
quentinleclerc:fix-organization-optional-default-environment
Closed

Can not create an organization without default_environment#3
quentinleclerc wants to merge 1 commit intojosh-silvas:mainfrom
quentinleclerc:fix-organization-optional-default-environment

Conversation

@quentinleclerc
Copy link
Copy Markdown
Collaborator

@quentinleclerc quentinleclerc commented May 20, 2024

default_environment is an optional argument of resource awx_organization. However if you don't set the variable, the provider still tries to associate the environment with id=0 to the organization, which result in a fail if it does not exist.

  # awx_organization.orga will be created
  + resource "awx_organization" "orga" {
      + id        = (known after apply)
      + max_hosts = 0
      + name      = "Organization name"
    }

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

awx_organization.orga: Creating...
╷
│ Error: Unable to create Organization
│ 
│   with awx_organization.orga,
│   on organizations.tf line 1, in resource "awx_organization" "orga":
│    1: resource "awx_organization" "orga" {
│ 
│ Unable to create Organization got Errors:
│ - default_environment: [Invalid pk "0" - object does not exist.]

@quentinleclerc quentinleclerc force-pushed the fix-organization-optional-default-environment branch from a814b58 to 2b58c3f Compare May 20, 2024 12:31
@quentinleclerc quentinleclerc deleted the fix-organization-optional-default-environment branch May 20, 2024 12:36
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