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

Allow multiple deployments #38

Merged
merged 3 commits into from
Nov 5, 2019
Merged

Allow multiple deployments #38

merged 3 commits into from
Nov 5, 2019

Conversation

zambien
Copy link
Owner

@zambien zambien commented Nov 2, 2019

fixes #28

The issue here occurred because we always took the latest deployment and returned it. Now we will select the actual deployment that is active. Note that this requires users to manage multiple proxy deployments if they want to do this. An example of this is:

apply 1:

resource "apigee_api_proxy" "tf1_helloworld" {
   name         = "tf1_helloworld"
   bundle       = "${path.module}/helloworld_proxy.zip"
   bundle_sha   = "${filebase64sha256("helloworld_proxy.zip")}"
}

resource "apigee_api_proxy_deployment" "foo_api_proxy_deployment" {
   proxy_name   = "${apigee_api_proxy.tf1_helloworld.name}"
   org          = "zambien-trial"
   env          = "test"
   revision     = "1"
}

apply 2:

resource "apigee_api_proxy" "tf1_helloworld" {
   name         = "tf1_helloworld"
   bundle       = "${path.module}/helloworld_proxy2.zip"
   bundle_sha   = "${filebase64sha256("helloworld_proxy2.zip")}"
}

resource "apigee_api_proxy_deployment" "foo_api_proxy_deployment" {
   proxy_name   = "${apigee_api_proxy.tf1_helloworld.name}"
   org          = "zambien-trial"
   env          = "test"
   revision     = "1"
}


resource "apigee_api_proxy_deployment" "foo_api_proxy_deployment2" {
   proxy_name   = "${apigee_api_proxy.tf1_helloworld.name}"
   org          = "zambien-trial"
   env          = "test"
   revision     = "latest" #or 2
   override     = true
}

I also made a fix for errors which would occur if using latest on a proxy deployment when the proxy was already deployed.

The output of terraform show after running both applies is:

# apigee_api_proxy.tf1_helloworld:
resource "apigee_api_proxy" "tf1_helloworld" {
    bundle       = "./helloworld_proxy2.zip"
    bundle_sha   = "bcRaaj0Vcp2biHPvQBiElVhopfY+h4ngZTQrhljIezE="
    id           = "adbc4519-f457-4601-9d95-697829cd60bb"
    name         = "tf1_helloworld"
    revision     = "2"
    revision_sha = "bcRaaj0Vcp2biHPvQBiElVhopfY+h4ngZTQrhljIezE="
}

# apigee_api_proxy_deployment.foo_api_proxy_deployment:
resource "apigee_api_proxy_deployment" "foo_api_proxy_deployment" {
    delay      = 0
    env        = "test"
    id         = "e721e174-843a-4f72-9c6c-3fea8918d574"
    org        = "zambien-trial"
    override   = false
    proxy_name = "tf1_helloworld"
    revision   = "1"
}

# apigee_api_proxy_deployment.foo_api_proxy_deployment2:
resource "apigee_api_proxy_deployment" "foo_api_proxy_deployment2" {
    delay      = 0
    env        = "test"
    id         = "2b01cba5-4366-4c3c-988c-e11d27edb85d"
    org        = "zambien-trial"
    override   = true
    proxy_name = "tf1_helloworld"
    revision   = "2"
}

@zambien zambien requested a review from zricethezav November 2, 2019 21:18
@zambien zambien merged commit db97c32 into master Nov 5, 2019
@zambien zambien deleted the allow_multiple_deployments branch November 5, 2019 21:52
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.

Managing multiple proxy deployments not working?
1 participant