atlassian / terraform-provider-artifactory

Terraform provider to manage Artifactory
Apache License 2.0
89 stars 42 forks source link

Update resource map properties after Terraform 0.12 API changes #48

Open jamestoyer opened 5 years ago

jamestoyer commented 5 years ago

Community Note

Description

Declarations of maps inside of Terraform 0.12 have changed and become stricter. This means you can no longer do:

resource "artifactory_permission_target" "deploy" {
  name = "t012_Deploy"

  repo = {
    includes_pattern = ["**"]

    repositories = ["libs-dev", "libs-prod"]

    actions = {
      users = [
        {
          name        = "deployuser1"
          permissions = ["read", "annotate", "write", "delete"]
        },
        {
          name        = "deployuser2"
          permissions = ["read", "annotate", "write", "delete"]
        },
      ]

      groups = [
        {
          name        = "deploygroup1"
          permissions = ["read", "annotate", "write", "delete"]
        },
      ]
    }
  }

Instead you must do:

resource "artifactory_permission_target" "deploy" {
  name = "t012_Deploy"

  repo {
    includes_pattern = ["**"]

    repositories = ["libs-dev", "libs-prod"]

    actions {
      users {
        name        = "deployuser1"
        permissions = ["read", "annotate", "write", "delete"]
      }

      users {
        name        = "deployuser2"
        permissions = ["read", "annotate", "write", "delete"]
      }

      groups {
        name        = "deploygroup1"
        permissions = ["read", "annotate", "write", "delete"]
      }
    }
  }
}

The names of users and groups should be de-pluralised as they are now multi declarations.

New or Affected Resource(s)

References

peimanja commented 5 years ago

Any update on this one? :)

peimanja commented 5 years ago

This is really blocking us from using terraform 0.12.x which gives us more flexibility in building modules.


Terraform v0.12.6
Configuring remote state backend...
Initializing Terraform configuration...
2019/09/05 20:47:33 [DEBUG] Using modified User-Agent: Terraform/0.12.6 PTFE/5dea1b8

Error: Failed to instantiate provider "artifactory" to obtain schema: Incompatible API version with plugin. Plugin version: 4, Client versions: [5]```
jamestoyer commented 5 years ago

v2.0.0-alpha1 should help you with your 0.12.x Terraform support. I've not had a chance to make the changes in the is PR, but the solution in #43 should still work

peimanja commented 4 years ago

@jamestoyer I have started using v2.0.0-alpha1 and works pretty good. Is there any plan to release v2.0.0 ? It's been a few months from v2.0.0-alpha1

peimanja commented 4 years ago

bump! :)