Skip to content

Can not create an organization without default_environment#4

Merged
josh-silvas merged 2 commits intojosh-silvas:mainfrom
quentinleclerc:fix-organization-optional-default-environment
May 20, 2024
Merged

Can not create an organization without default_environment#4
josh-silvas merged 2 commits intojosh-silvas:mainfrom
quentinleclerc:fix-organization-optional-default-environment

Conversation

@quentinleclerc
Copy link
Copy Markdown
Collaborator

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.]

@josh-silvas
Copy link
Copy Markdown
Owner

Thanks for the contribution @quentinleclerc! The build is currently failing due to some changes in golang-ci lint, which subsequently fired off some other lint fixes I will need to make. I'll approve this then submit another PR to clean up the linting changes.

@josh-silvas josh-silvas merged commit 6f2cae9 into josh-silvas:main May 20, 2024
@josh-silvas
Copy link
Copy Markdown
Owner

ok, v1.0.10 released which should include your changes.

@quentinleclerc
Copy link
Copy Markdown
Collaborator Author

Perfect, thanks for quick answser!

@quentinleclerc quentinleclerc deleted the fix-organization-optional-default-environment branch May 29, 2024 12:55
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