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

cloudflare_zero_trust_access_policy has drift w/ gsuite identity_provider_id #4207

Open
3 tasks done
rsyring opened this issue Oct 4, 2024 · 4 comments
Open
3 tasks done
Labels
kind/bug Categorizes issue or PR as related to a bug. service/access Categorizes issue or PR as related to the Access service. triage/accepted Indicates an issue or PR is ready to be actively worked on. triage/debug-log-attached Indicates an issue or PR has a complete Terraform debug log. workflow/synced

Comments

@rsyring
Copy link

rsyring commented Oct 4, 2024

Confirmation

  • This is a bug with an existing resource and is not a feature request or enhancement. Feature requests should be submitted with Cloudflare Support or your account team.
  • I have searched the issue tracker and my issue isn't already found.
  • I have replicated my issue using the latest version of the provider and it is still present.

Terraform and Cloudflare provider version

❯ terraform --version
Terraform v1.9.7
on linux_amd64

  • provider registry.terraform.io/cloudflare/cloudflare v4.43.0

Affected resource(s)

cloudflare_zero_trust_access_policy

Terraform configuration files

resource "cloudflare_zero_trust_access_identity_provider" "google_oauth" {
  account_id = local.acct_id
  name       = "Google OAuth"
  type       = "google"
  config {
    client_id     = var.GOOGLE_CLIENT_ID
    client_secret = var.GOOGLE_CLIENT_SECRET
  }
}


resource "cloudflare_zero_trust_access_application" "cf_app" {
  account_id       = local.acct_id
  name             = "Google Authentication"
  domain           = "redacted.pages.dev"
  type             = "self_hosted"
  session_duration = "720h"
  allowed_idps     = ["${cloudflare_zero_trust_access_identity_provider.google_oauth.id}"]
}


resource "cloudflare_zero_trust_access_policy" "cf_policy" {
  application_id = cloudflare_zero_trust_access_application.cf_app.id
  zone_id        = data.cloudflare_zone.this.zone_id
  name           = "Google oauth allow policy"
  precedence     = "1"
  decision       = "allow"

  include {
    email_domain = ["redacted"]
    gsuite {
      identity_provider_id = cloudflare_zero_trust_access_identity_provider.google_oauth.id
    }
  }
}

Link to debug output

https://gist.github.com/rsyring/c2208f4ea6d1a7337b8985ebae006ccb

Panic output

No response

Expected output

After running terraform apply and not making any changes to the configuration, I expected terraform plan to not show any changes.

Actual output

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # cloudflare_zero_trust_access_policy.cf_policy will be updated in-place
  ~ resource "cloudflare_zero_trust_access_policy" "cf_policy" {
        id                             = "de5a3aa6-6847-41f4-b059-5f1c7a376295"
        name                           = "Google oauth allow policy"
        # (8 unchanged attributes hidden)

      ~ include {
            # (16 unchanged attributes hidden)

          + gsuite {
              + identity_provider_id = "bea60213-50fd-4f9b-a94e-69b0945bdacb"
            }
        }
    }

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

Steps to reproduce

  1. Setup the config of the cloudflare resources as given above.
  2. terraform plan...
  3. terraform apply...
  4. terraform plan...

Additional factoids

No response

References

No response

@rsyring rsyring added kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Oct 4, 2024
Copy link
Contributor

github-actions bot commented Oct 4, 2024

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

Copy link
Contributor

github-actions bot commented Oct 4, 2024

Terraform debug log detected ✅

@github-actions github-actions bot added triage/needs-information Indicates an issue needs more information in order to work on it. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Oct 4, 2024
@rsyring
Copy link
Author

rsyring commented Oct 4, 2024

@github-actions github-actions bot added triage/debug-log-attached Indicates an issue or PR has a complete Terraform debug log. and removed triage/needs-information Indicates an issue needs more information in order to work on it. labels Oct 4, 2024
@jacobbednarz jacobbednarz added triage/accepted Indicates an issue or PR is ready to be actively worked on. service/access Categorizes issue or PR as related to the Access service. labels Oct 7, 2024
@BSFishy
Copy link
Contributor

BSFishy commented Nov 13, 2024

Hi @rsyring can you try adding the email value in the gsuite rule?

According to API docs, both the IDP ID and email are required for the gsuite rule, so this may just be the Terraform schema allows for these values to be optional when they should be required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. service/access Categorizes issue or PR as related to the Access service. triage/accepted Indicates an issue or PR is ready to be actively worked on. triage/debug-log-attached Indicates an issue or PR has a complete Terraform debug log. workflow/synced
Projects
None yet
Development

No branches or pull requests

3 participants