Skip to content

feat!: Remove drift#887

Merged
disq merged 19 commits intocloudquery:mainfrom
disq:feat/hcl-to-yaml-config
Jun 21, 2022
Merged

feat!: Remove drift#887
disq merged 19 commits intocloudquery:mainfrom
disq:feat/hcl-to-yaml-config

Conversation

@disq
Copy link
Copy Markdown
Member

@disq disq commented Jun 13, 2022

Continued from #752

  • cq init should generate yaml
  • after config parse, actions must be taken to set/reinit values from config
  • make sure json-schema passes
  • all providers will need to change, as example configs are hcl
  • sdk needs to be updated (GetProviderConfig)
  • policies will need updating/converting
  • cq init should get yaml config from providers and correctly inject it?

@disq disq requested review from a team and bbernays and removed request for a team June 13, 2022 16:04
@disq disq marked this pull request as draft June 13, 2022 16:05
@bbernays
Copy link
Copy Markdown
Collaborator

I don't think we should be removing hcl support in the same PR we are adding yaml support. This would allow users to transition over at their own pace, while also lowering the testing bar for us as we won't be breaking any functionality

@disq
Copy link
Copy Markdown
Member Author

disq commented Jun 13, 2022

I don't think we should be removing hcl support in the same PR we are adding yaml support. This would allow users to transition over at their own pace, while also lowering the testing bar for us as we won't be breaking any functionality

Why not introduce a converter? Otherwise the code gets very complicated (especially provider config logic in the SDK)

@yevgenypats
Copy link
Copy Markdown
Contributor

I also not sure about having two code bases and bug types to support - what is the value of customers upgrading at their own pace? eventually we will have to deprecate anyway. I think converter might be a better take and even that I think it should be a big deal to run cloudquery init aws and convert manually - I think given in terms of where we are in terms of users this should be ok to introduce such breaking change as long as we have good documentation, explanation and it's a major version etc...

@disq disq force-pushed the feat/hcl-to-yaml-config branch 5 times, most recently from 12fd8cd to 87356fc Compare June 16, 2022 16:17
@disq
Copy link
Copy Markdown
Member Author

disq commented Jun 16, 2022

go run main.go init test --config config.yml results:

cloudquery:
    providers:
        - name: test
          version: latest
    connection:
        type: postgres
        username: postgres
        password: pass
        host: localhost
        port: 15432
        database: postgres
        sslmode: disable
providers:
    # provider configurations
    test:
        account:
            name: "1"
            id: testid
        regions:
            - asdas
        resources:
            # list of resources to fetch
            - slow_resource
            - very_slow_resource
            - error_resource
            - panic_resource
            - migrate_resource

moving the comments above the list entries is complicated, not sure if it's even possible without getting dirty (dirtier). The problem is, yaml.Node is good for reading data but when you encode it on the root level (if you don't use a map to hold your root keys, like I was forced to do after many iterations) the results aren't pretty, it simply marshals the whole meta-struct and not just the contents.

@disq disq marked this pull request as ready for review June 16, 2022 21:04
@disq disq requested review from roneli and yevgenypats June 16, 2022 21:35
@yevgenypats
Copy link
Copy Markdown
Contributor

Nice! Going to run locally and play with so I can give a more thorough review but one nit in the meanwhile. I think given it will be a breaking change the default should be the yaml generator and if someone want to use the old hcl format he will need to use the flag. This way more users will migrate faster and we can deprecate hcl faster.

Copy link
Copy Markdown
Contributor

@roneli roneli left a comment

Choose a reason for hiding this comment

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

Looks good, two comments :)

@disq disq force-pushed the feat/hcl-to-yaml-config branch 2 times, most recently from e659ad7 to 7aa7905 Compare June 20, 2022 08:37
@disq disq force-pushed the feat/hcl-to-yaml-config branch from 5daf4a2 to d5096bf Compare June 20, 2022 15:50
@disq disq changed the title feat!: Remove HCL in favor of YAML, remove drift feat!: Remove drift Jun 21, 2022
@disq disq force-pushed the feat/hcl-to-yaml-config branch from 40f15ef to b6d9445 Compare June 21, 2022 08:46
@disq disq merged commit 3d387bd into cloudquery:main Jun 21, 2022
@disq disq deleted the feat/hcl-to-yaml-config branch June 21, 2022 08:51
kodiakhq bot pushed a commit that referenced this pull request Jun 21, 2022
🤖 I have created a release *beep* *boop*
---


## [0.27.0-rc1](v0.26.4...v0.27.0-rc1) (2022-06-21)


### ⚠ BREAKING CHANGES

* Remove drift (#887)

### Features

* Remove drift ([#887](#887)) ([3d387bd](3d387bd))


### Miscellaneous Chores

* Release 0.27.0-rc1 ([#962](#962)) ([3a2ec6d](3a2ec6d))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
kodiakhq bot pushed a commit that referenced this pull request Jun 22, 2022
🤖 I have created a release *beep* *boop*
---


## [0.27.0](v0.26.4...v0.27.0) (2022-06-22)


### ⚠ BREAKING CHANGES

* Remove drift (#887)

### Features

* Remove drift ([#887](#887)) ([3d387bd](3d387bd))
* Add YAML configuration support ([#887](#887)) ([3d387bd](3d387bd))

### Bug Fixes

* Default alias to name ([#966](#966)) ([706447c](706447c))
* Support modules tag in config ([#965](#965)) ([379344f](379344f))
* **deps:** Update module github.com/cloudquery/cq-provider-sdk to v0.12.1 ([#972](#972)) ([1f871e9](1f871e9))
* Request correct config format (YAML) from provider ([#968](#968)) ([999b68d](999b68d))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
kodiakhq bot pushed a commit to cloudquery/cq-provider-azure that referenced this pull request Jun 22, 2022
to go with cloudquery/cq-provider-sdk#332 and cloudquery/cloudquery#887

`go run main.go init azure --config config.yml` creates this:
```yaml
cloudquery:
    providers:
        - name: azure
          version: latest
    connection:
        type: postgres
        username: postgres
        password: pass
        host: localhost
        port: 5432
        database: postgres
        sslmode: disable
providers:
    # provider configurations
    - name: azure
      # Optional. if you not specified, cloudquery tries to access all subscriptions available to tenant
      # subscriptions:
      #   - <YOUR_SUBSCRIPTION_ID_HERE>
      #  
      # list of resources to fetch
      resources:
        - account.locations
        - authorization.role_assignments
#...
```
erezrokah pushed a commit that referenced this pull request Aug 14, 2022
to go with cloudquery/cq-provider-sdk#332 and #887

`go run main.go init okta --config config.yml` creates this:
```yaml
cloudquery:
    providers:
        - name: okta
          version: latest
    connection:
        type: postgres
        username: postgres
        password: pass
        host: localhost
        port: 5432
        database: postgres
        sslmode: disable
providers:
    # provider configurations
    - name: okta
      # Optional. Okta Token to access API, you can set this with OKTA_API_TOKEN env variable
      # token = <YOUR_OKTA_TOKEN>
      # Required. You okta domain name
      # domain =  https://<CHANGE_THIS_TO_YOUR_OKTA_DOMAIN>.okta.com
      #  
      # list of resources to fetch
      resources:
        - users
```
erezrokah pushed a commit that referenced this pull request Aug 14, 2022
to go with cloudquery/cq-provider-sdk#332 and #887

`go run main.go init azure --config config.yml` creates this:
```yaml
cloudquery:
    providers:
        - name: azure
          version: latest
    connection:
        type: postgres
        username: postgres
        password: pass
        host: localhost
        port: 5432
        database: postgres
        sslmode: disable
providers:
    # provider configurations
    - name: azure
      # Optional. if you not specified, cloudquery tries to access all subscriptions available to tenant
      # subscriptions:
      #   - <YOUR_SUBSCRIPTION_ID_HERE>
      #  
      # list of resources to fetch
      resources:
        - account.locations
        - authorization.role_assignments
#...
```
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.

4 participants