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

azurerm_container_group: Splitting command into commands #1740

Merged
merged 4 commits into from
Aug 9, 2018

Conversation

tombuildsstuff
Copy link
Contributor

Given the following config:

resource "azurerm_resource_group" "test" {
  name     = "tharvey-containergroup"
  location = "West Europe"
}

resource "azurerm_container_group" "test" {
  name                = "tom-devcg"
  location            = "${azurerm_resource_group.test.location}"
  resource_group_name = "${azurerm_resource_group.test.name}"
  ip_address_type     = "public"
  dns_name_label      = "tom-devcg"
  os_type             = "windows"
  restart_policy      = "Never"

  container {
    name   = "windowsservercore"
    image  = "microsoft/windowsservercore:latest"
    cpu    = "2.0"
    memory = "3.5"
    port   = "80"

    environment_variables {
      "foo"  = "bar"
      "foo1" = "bar1"
    }

    command = "cmd.exe echo hi"
  }

  tags {
    environment = "Testing"
  }
}

Plan between applied changes from current master -> this PR:

$ envchain azurerm terraform plan


Warning: azurerm_container_group.test: "container.0.command": [DEPRECATED] Use `commands` instead.



Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

azurerm_resource_group.test: Refreshing state... (ID: /subscriptions/00000000-0000-0000-0000-.../resourceGroups/tharvey-containergroup)
azurerm_container_group.test: Refreshing state... (ID: /subscriptions/00000000-0000-0000-0000-...inerInstance/containerGroups/tom-devcg)

------------------------------------------------------------------------

No changes. Infrastructure is up-to-date.

This means that Terraform did not detect any differences between your
configuration and real physical resources that exist. As a result, no
actions need to be performed.

When updating command to be commands:

commands = ["cmd.exe", "echo", "hi"]

the following plan is generated:

$ envchain azurerm terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

azurerm_resource_group.test: Refreshing state... (ID: /subscriptions/00000000-0000-0000-0000-.../resourceGroups/tharvey-containergroup)
azurerm_container_group.test: Refreshing state... (ID: /subscriptions/00000000-0000-0000-0000-...inerInstance/containerGroups/tom-devcg)

------------------------------------------------------------------------

No changes. Infrastructure is up-to-date.

This means that Terraform did not detect any differences between your
configuration and real physical resources that exist. As a result, no
actions need to be performed.

Supersedes #1508

@tombuildsstuff
Copy link
Contributor Author

Tests pass:

$ acctests azurerm TestAccAzureRMContainerGroup_
=== RUN   TestAccAzureRMContainerGroup_imageRegistryCredentials
--- PASS: TestAccAzureRMContainerGroup_imageRegistryCredentials (135.30s)
=== RUN   TestAccAzureRMContainerGroup_imageRegistryCredentialsUpdate
--- PASS: TestAccAzureRMContainerGroup_imageRegistryCredentialsUpdate (147.04s)
=== RUN   TestAccAzureRMContainerGroup_linuxBasic
--- PASS: TestAccAzureRMContainerGroup_linuxBasic (119.29s)
=== RUN   TestAccAzureRMContainerGroup_linuxBasicUpdate
--- PASS: TestAccAzureRMContainerGroup_linuxBasicUpdate (141.96s)
=== RUN   TestAccAzureRMContainerGroup_linuxComplete
--- PASS: TestAccAzureRMContainerGroup_linuxComplete (134.44s)
=== RUN   TestAccAzureRMContainerGroup_windowsBasic
--- PASS: TestAccAzureRMContainerGroup_windowsBasic (99.55s)
=== RUN   TestAccAzureRMContainerGroup_windowsComplete
--- PASS: TestAccAzureRMContainerGroup_windowsComplete (91.03s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	868.949s

@@ -121,6 +121,10 @@ The `container` block supports:

* `command` - (Optional) A command line to be run on the container. Changing this forces a new resource to be created.

~> **NOTE:** The field `command` has been deprecated in favour of `commands` to better match the API.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

favour so british...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And Canadian!

Optional: true,
ForceNew: true,
Computed: true,
Deprecated: "Use `commands` instead.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these have ConflictsWith?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should - but it’s an unsized list so that’s not possible (and customizeDiff doesn’t handle interpolations, which could be used here - so I don’t see that as a viable approach)

@tombuildsstuff
Copy link
Contributor Author

Tests pass after the commit removing crash points:

$ acctests azurerm TestAccAzureRMContainerGroup_
=== RUN   TestAccAzureRMContainerGroup_imageRegistryCredentials
--- PASS: TestAccAzureRMContainerGroup_imageRegistryCredentials (122.38s)
=== RUN   TestAccAzureRMContainerGroup_imageRegistryCredentialsUpdate
--- PASS: TestAccAzureRMContainerGroup_imageRegistryCredentialsUpdate (195.31s)
=== RUN   TestAccAzureRMContainerGroup_linuxBasic
--- PASS: TestAccAzureRMContainerGroup_linuxBasic (116.01s)
=== RUN   TestAccAzureRMContainerGroup_linuxBasicUpdate
--- PASS: TestAccAzureRMContainerGroup_linuxBasicUpdate (193.52s)
=== RUN   TestAccAzureRMContainerGroup_linuxComplete
--- PASS: TestAccAzureRMContainerGroup_linuxComplete (181.55s)
=== RUN   TestAccAzureRMContainerGroup_windowsBasic
--- PASS: TestAccAzureRMContainerGroup_windowsBasic (156.15s)
=== RUN   TestAccAzureRMContainerGroup_windowsComplete
--- PASS: TestAccAzureRMContainerGroup_windowsComplete (143.25s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	1108.512s

@tombuildsstuff tombuildsstuff merged commit a8ddd77 into master Aug 9, 2018
@tombuildsstuff tombuildsstuff deleted the containergroup-command branch August 9, 2018 19:20
tombuildsstuff added a commit that referenced this pull request Aug 9, 2018
@ghost
Copy link

ghost commented Mar 30, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants