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

Cannot create and immediately activate an empty shared edge redirector cloudlet #611

Open
siwinski opened this issue Feb 5, 2025 · 1 comment

Comments

@siwinski
Copy link

siwinski commented Feb 5, 2025

When creating an empty shared edge redirector cloudlet, the cloudlet itself is created (can be seen via Control Center, not via Terraform output) but a version is not created which causes immediate activations to fail.

When manually creating a shared edge redirector cloudlet via Control Center, a version is created.

Terraform and Akamai Terraform Provider Versions

Terraform v1.10.5
on linux_amd64
+ provider registry.terraform.io/akamai/akamai v7.0.0

Affected Resource(s)

akamai_cloudlets_policy

Terraform Configuration Files

terraform {
  required_providers {
    akamai = {
      source  = "akamai/akamai"
      version = ">= 7.0.0, < 8.0.0"
    }
  }
}

data "akamai_cloudlets_edge_redirector_match_rule" "default" {
}

resource "akamai_cloudlets_policy" "policy" {
  name          = "test_shared_empty"
  cloudlet_code = "ER"
  group_id      = 1234567890 # Set this to a valid group ID
  is_shared     = true
  match_rules   = data.akamai_cloudlets_edge_redirector_match_rule.default.json
}

resource "akamai_cloudlets_policy_activation" "staging" {
  policy_id = akamai_cloudlets_policy.policy.id
  network   = "staging"
  version   = akamai_cloudlets_policy.policy.version
}

resource "akamai_cloudlets_policy_activation" "production" {
  policy_id = akamai_cloudlets_policy.policy.id
  network   = "production"
  version   = akamai_cloudlets_policy.policy.version
}

Output

data.akamai_cloudlets_edge_redirector_match_rule.default: Reading...
data.akamai_cloudlets_edge_redirector_match_rule.default: Read complete after 0s [id=data_akamai_cloudlets_edge_redirector_match_rule]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # akamai_cloudlets_policy.policy will be created
  + resource "akamai_cloudlets_policy" "policy" {
      + cloudlet_code = "ER"
      + cloudlet_id   = (known after apply)
      + group_id      = "1234567890"
      + id            = (known after apply)
      + is_shared     = true
      + name          = "test_shared_empty"
      + version       = (known after apply)
      + warnings      = (known after apply)
        # (1 unchanged attribute hidden)
    }

  # akamai_cloudlets_policy_activation.production will be created
  + resource "akamai_cloudlets_policy_activation" "production" {
      + id        = (known after apply)
      + is_shared = (known after apply)
      + network   = "prod"
      + policy_id = (known after apply)
      + status    = (known after apply)
      + version   = (known after apply)
    }

  # akamai_cloudlets_policy_activation.staging will be created
  + resource "akamai_cloudlets_policy_activation" "staging" {
      + id        = (known after apply)
      + is_shared = (known after apply)
      + network   = "staging"
      + policy_id = (known after apply)
      + status    = (known after apply)
      + version   = (known after apply)
    }

Plan: 3 to add, 0 to change, 0 to destroy.
akamai_cloudlets_policy.policy: Creating...
akamai_cloudlets_policy.policy: Creation complete after 0s [id=261532]

Error: Missing required argument

  with akamai_cloudlets_policy_activation.staging,
  on main.tf line 24, in resource "akamai_cloudlets_policy_activation" "staging":
  24:   version   = akamai_cloudlets_policy.policy.version

The argument "version" is required, but no definition was found.

Error: Missing required argument

  with akamai_cloudlets_policy_activation.production,
  on main.tf line 30, in resource "akamai_cloudlets_policy_activation" "production":
  30:   version   = akamai_cloudlets_policy.policy.version

The argument "version" is required, but no definition was found.
@PawelSnoch
Copy link

Hello @siwinski ,

thank you for reporting this issue.
Unfortunately API behavior is the same as terraform. For the time being you need to provide valid match_rules to create policy version. You can extend your data and provide your values for redirect_url and status_code.

data "akamai_cloudlets_edge_redirector_match_rule" "default" {
  match_rules {
    redirect_url = ""
    status_code  = 302
  }
}

I hope this helps.

Best regards,
Pawel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants