Giter Club home page Giter Club logo

terraform-provider-rgw's People

Contributors

rissson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

rgruyters

terraform-provider-rgw's Issues

Plugin crashed if subuser exists

Hey! I get an error:

bi@tpad:~/git/rgw$ terraform plan
rgw_user.test_user2: Refreshing state... [id=test2]
rgw_user.test_user: Refreshing state... [id=test]
rgw_user.my_user: Refreshing state... [id=my_user]
╷
│ Error: Plugin did not respond
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ReadResource call. The plugin logs may contain more details.
╵
╷
│ Error: Plugin did not respond
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ReadResource call. The plugin logs may contain more details.
╵
╷
│ Error: Plugin did not respond
│ 
│   with rgw_user.test_user2,
│   on main.tf line 35, in resource "rgw_user" "test_user2":
│   35: resource "rgw_user" "test_user2" {
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ReadResource call. The plugin logs may contain more details.
╵

Stack trace from the terraform-provider-rgw_v0.1.0 plugin:

panic: interface conversion: interface {} is map[string]interface {}, not struct { ID string; Permissions string }

goroutine 103 [running]:
terraform-provider-rgw/rgw.flattenRgwSubuser(0xc86ee0, 0xc000643e60, 0x0, 0x0)
        terraform-provider-rgw/rgw/resource_user.go:256 +0x1b6
reflect.Value.call(0xc638a0, 0xda6f60, 0x13, 0xd69668, 0x4, 0xc000622ae0, 0x1, 0x1, 0xc000622a18, 0x4c4a70, ...)
        reflect/value.go:476 +0x8e7
reflect.Value.Call(0xc638a0, 0xda6f60, 0x13, 0xc000622ae0, 0x1, 0x1, 0x194, 0xc000456900, 0x0)
        reflect/value.go:337 +0xb9
github.com/thoas/go-funk.mapSlice(0xc463e0, 0xc000180180, 0x97, 0xc638a0, 0xda6f60, 0x13, 0x7f266a704600, 0x20300000000000, 0xc000622bd0)
        github.com/thoas/[email protected]/transform.go:123 +0x3a6
github.com/thoas/go-funk.mapFn(0xc463e0, 0xc000180180, 0xc638a0, 0xda6f60, 0xd69309, 0x3, 0xc6b940, 0xd36401, 0xc000180180)
        github.com/thoas/[email protected]/transform.go:226 +0x276
github.com/thoas/go-funk.Map(0xc463e0, 0xc000180180, 0xc638a0, 0xda6f60, 0xc000449bc8, 0x0)
        github.com/thoas/[email protected]/transform.go:199 +0x65
terraform-provider-rgw/rgw.flattenRgwUser(0xc0003d87b0, 0x5, 0xc0003d87b5, 0x5, 0xc0003d87ba, 0x5, 0xc0003d87c0, 0xc0003d87c8, 0xc0005b8a80, 0x1, ...)
        terraform-provider-rgw/rgw/resource_user.go:314 +0x30f
terraform-provider-rgw/rgw.resourceUserRead(0xeea0a8, 0xc000084780, 0xc0005d6000, 0xd2a680, 0xc0006ce740, 0xc0005b2aa0, 0xc0006ed908, 0x40e0f8)
        terraform-provider-rgw/rgw/resource_user.go:368 +0x2b8
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0xc00027aa80, 0xeea038, 0xc0006ceb40, 0xc0005d6000, 0xd2a680, 0xc0006ce740, 0x0, 0x0, 0x0)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:358 +0x17f
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc00027aa80, 0xeea038, 0xc0006ceb40, 0xc000253e10, 0xd2a680, 0xc0006ce740, 0xc0005b4258, 0x0, 0x0, 0x0)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:635 +0x1cb
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0xc00000d470, 0xeea038, 0xc0006ceb40, 0xc0006ceb80, 0xc0006ceb40, 0x40b965, 0xd03820)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:576 +0x47d
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ReadResource(0xc0004cba00, 0xeea0e0, 0xc0006ceb40, 0xc0006d7980, 0xc0004cba00, 0xc0001732f0, 0xc0006e7ba0)
        github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:298 +0x105
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadResource_Handler(0xd32ae0, 0xc0004cba00, 0xeea0e0, 0xc0001732f0, 0xc0006d7920, 0x0, 0xeea0e0, 0xc0001732f0, 0xc000326240, 0x23f)
        github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:344 +0x214
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000374fc0, 0xef1198, 0xc000602900, 0xc0006d8300, 0xc000402690, 0x13267f0, 0x0, 0x0, 0x0)
        google.golang.org/[email protected]/server.go:1194 +0x52b
google.golang.org/grpc.(*Server).handleStream(0xc000374fc0, 0xef1198, 0xc000602900, 0xc0006d8300, 0x0)
        google.golang.org/[email protected]/server.go:1517 +0xd0c
google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc000400180, 0xc000374fc0, 0xef1198, 0xc000602900, 0xc0006d8300)
        google.golang.org/[email protected]/server.go:859 +0xab
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/[email protected]/server.go:857 +0x1fd

Error: The terraform-provider-rgw_v0.1.0 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.

My main.tf looks like this:

terraform { 
  required_providers {
    rgw = {
      source = "risson/rgw"
      version = "0.1.0"
    }
  }
}

provider "rgw" {
  endpoint = "http://$my_rgw_endpoint"
}

resource "rgw_user" "my_user" {
  user_id      = "my_user"
  display_name = "My User"
  email = "[email protected]"
}

resource "rgw_user" "test_user" {
  user_id      = "test"
  display_name = "test"
}

resource "rgw_user" "test_user2" {
  user_id      = "test2"
  display_name = "test2"
}

My cluster version and user information:

# radosgw --version
ceph version 16.2.6 (ee28fb57e47e9f88813e24bbf4c14496ca299d31) pacific (stable)
# radosgw-admin user info --uid=test2
{
    "user_id": "test2",
    "display_name": "test2",
...
    "subusers": [
        {
            "id": "test2:bober",
            "permissions": "read"
        }
    ],
    "keys": [
        {
            "user": "test2:bober",
            "access_key": "xxxx",
            "secret_key": "xxxx"
        },
        {
            "user": "test2",
            "access_key": "xxx",
            "secret_key": "xxx"
        }
    ],
...
}

If I remove the subuser and run the terraform plan everything works.

Hide sensitive output of a resource when it is removed.

I think it would be right to hide the resource's sensitive output in the plan/apply when trying to delete it:

Terraform will perform the following actions:
  # module.dev_test_delete.rgw_user.s3_user will be destroyed
  - resource "rgw_user" "s3_user" {
      - bucket_quota   = [
          - {
              - check_on_raw = false
              - enabled      = false
              - max_objects  = -1
              - max_size     = -1
              - max_size_kb  = 0
              - type         = ""
              - user_id      = "dev-dev-dev"
            },
        ] -> null
      - caps           = [] -> null
      - display_name   = "unknown, BDI-9661" -> null
      - id             = "dev-dev-dev" -> null
      - keys           = [
          - {
              - access_key = "xxxxx"
              - secret_key = "xxxxx"
              - user       = "dev-dev-dev"
            },
 ....
    }

Support for tenant

When we create a new radosgw user we use tenant as well. It would be nice to include this option.

Error: NoSuchUser

When using tenant with user_id I get with the next plan, apply or destroy the following error:

Error: NoSuchUser tx00000000000000000c41c-006294b945-2bd8627-test-sc 2bd8627-test-sc-test

Here are the steps that i'm following:

$ terraform apply

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:

  # rgw_user.my_user will be created
  + resource "rgw_user" "my_user" {
      + bucket_quota          = (known after apply)
      + caps                  = (known after apply)
      + default_placement     = (known after apply)
      + default_storage_class = (known after apply)
      + display_name          = "Test account via Terraform"
      + email                 = (known after apply)
      + id                    = (known after apply)
      + keys                  = (known after apply)
      + max_buckets           = (known after apply)
      + op_mask               = (known after apply)
      + placement_tags        = (known after apply)
      + subusers              = (known after apply)
      + suspended             = (known after apply)
      + swift_keys            = (known after apply)
      + type                  = (known after apply)
      + user_id               = "robin_test$robin"
      + user_quota            = (known after apply)
    }

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

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

rgw_user.my_user: Creating...
rgw_user.my_user: Creation complete after 0s [id=robin_test$robin]

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
$ terraform plan
rgw_user.my_user: Refreshing state... [id=robin_test$robin]
╷
│ Error: NoSuchUser tx00000000000000000c41c-006294b945-2bd8627-test-sc 2bd8627-test-sc-test
│
│   with rgw_user.my_user,
│   on main.tf line 14, in resource "rgw_user" "my_user":
│   14: resource "rgw_user" "my_user" {
│

The user is available on radosgw service:

$ sudo radosgw-admin user list
[
    "robin_test$robin",
]

Here is my main.tf file:

terraform {
  required_providers {
    rgw = {
      source = "rissson/rgw"
      version = "0.3.1"
    }
  }
}

provider "rgw" {
  # Configuration options
}

resource "rgw_user" "my_user" {
  user_id      = "robin_test$robin"
  display_name = "Test account via Terraform"
}

Feature Request: Manage Buckets

Hi @rissson,

thank you for creating this Terraform provider.

I would like to be able to also manage buckets created in rgw. Is there any chance of getting this implemented? My Go skills are quite basic so I don't think I'd be of any help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.