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

Specifying saml_metadata_document causes plan, apply and destroy to fail #76

Open
ikegentz opened this issue Jun 27, 2023 · 1 comment
Labels
bug 🐛 An issue with the system

Comments

@ikegentz
Copy link

ikegentz commented Jun 27, 2023

Describe the Bug

First-time apply, plan, as well as destroy operations fail if saml_metadata_document is set to something that isn't a hard-coded local file. It fails with the following error:

Error: Invalid count argument

  on ***/***/***/main.tf line 144, in resource "aws_iam_saml_provider" "default":
 144:   count = local.enabled && var.saml_metadata_document != null ? 1 : 0

The "count" value depends on resource attributes that cannot be determined
until apply, so Terraform cannot predict how many instances will be
created. To work around this, use the -target argument to first apply only
the resources that the count depends on.

Expected Behavior

You should be able to have saml_metadata_document refer to some other resource which creates that document.

Steps to Reproduce

Create some resource that generates the saml_metadata_document (in our case for example, we create an okta_app_saml resource, and set saml_metadata_document to okta_app_saml.example.metadata.

If okta_app_saml hasn't been apply'd prior to when you apply the module (or when running plan, you'll get that error. You'll also get that error anytime you try to destroy the module

Screenshots

No response

Environment

Module Version: 0.16.0
Terraform Version: 1.5.0

Additional Context

No response

@ikegentz ikegentz added the bug 🐛 An issue with the system label Jun 27, 2023
@ikegentz ikegentz changed the title Specifying saml_metadata_document causes apply and destroy to fail Specifying saml_metadata_document causes plan, apply and destroy to fail Jun 27, 2023
@Nuru
Copy link
Contributor

Nuru commented Aug 1, 2023

Yes, this kind of thing has been a source of great frustration with Terraform over the years. Unfortunately, the solution is a breaking change, changing the type of this and other optional variables to list. As such, it will likely be quite some time before we get to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An issue with the system
Projects
None yet
Development

No branches or pull requests

2 participants