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

Data source juju_application #630

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

shipperizer
Copy link

@shipperizer shipperizer commented Nov 15, 2024

Description

Creation of a juju_application data source

Type of change

  • Add new resource

Environment

  • Juju controller version: 3.5+

  • Terraform version: 1.8.2+

QA steps

Manual QA steps should be done to test this PR.

terraform {
  required_providers {
    juju = {
      source  = "juju/juju"
      version = "> 0.14.0"
    }
  }

  required_version = ">= 1.5.0"
}

variable "revision" {
  type = string
}
########################

resource "juju_application" "hydra" {
  model = "test"
  trust = true

  charm {
    name    = "hydra"
    channel = "latest/edge"
    base    = "[email protected]"
    revision = var.revision
  }
}


### HYDRA dependent ###
data "juju_application" "hydra" {
  model = juju_application.hydra.model
  name  = juju_application.hydra.name
}

@jujubot
Copy link
Contributor

jujubot commented Nov 15, 2024

Thanks for opening a pull request! Please follow the instructions here to ensure your pull request is ready for review. Then, a maintainer will review your patch.

@hpidcock @anvial

1 similar comment
@jujubot
Copy link
Contributor

jujubot commented Nov 15, 2024

Thanks for opening a pull request! Please follow the instructions here to ensure your pull request is ready for review. Then, a maintainer will review your patch.

@hpidcock @anvial

@shipperizer shipperizer marked this pull request as draft November 15, 2024 11:55
@shipperizer shipperizer force-pushed the ds/application branch 3 times, most recently from 61af9f7 to cba4340 Compare November 15, 2024 15:33
@shipperizer shipperizer marked this pull request as ready for review November 15, 2024 15:37
@shipperizer shipperizer changed the title Ds/application Data source juju_application Nov 15, 2024
@hmlanigan hmlanigan added the state/codefreeze this pr cannot land until the code freeze has lifted. label Nov 15, 2024
internal/provider/data_source_application.go Show resolved Hide resolved
internal/provider/data_source_application.go Outdated Show resolved Hide resolved
internal/provider/data_source_application.go Outdated Show resolved Hide resolved
internal/provider/data_source_application.go Outdated Show resolved Hide resolved
docs/data-sources/application.md Outdated Show resolved Hide resolved
@shipperizer shipperizer force-pushed the ds/application branch 2 times, most recently from ed4b00c to a979d62 Compare November 18, 2024 13:10
Copy link

@pik4ez-canonical pik4ez-canonical left a comment

Choose a reason for hiding this comment

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

A couple minor comments/documentation adjustments requested. Otherwise LGTM.

internal/provider/data_source_application.go Outdated Show resolved Hide resolved

Choose a reason for hiding this comment

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

I believe docs/index.md also needs to be adjusted to include the application data source.

Copy link
Member

@hmlanigan hmlanigan left a comment

Choose a reason for hiding this comment

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

I'm confused about to why this is new data source is useful if it no longer contains the trust and units value?

internal/provider/data_source_application.go Outdated Show resolved Hide resolved
internal/provider/data_source_application_test.go Outdated Show resolved Hide resolved
internal/provider/provider.go Outdated Show resolved Hide resolved
internal/provider/data_source_application.go Outdated Show resolved Hide resolved
internal/provider/data_source_application.go Outdated Show resolved Hide resolved
internal/provider/helpers.go Outdated Show resolved Hide resolved
@alesstimec alesstimec removed the state/codefreeze this pr cannot land until the code freeze has lifted. label Dec 3, 2024
Description: "A data source that represents a single Juju application deployment from a charm.",
Attributes: map[string]schema.Attribute{
"name": schema.StringAttribute{
Description: "Name of the application deployment.",
Copy link
Member

Choose a reason for hiding this comment

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

nitpick: "Name of the application."

return
}

//SubsystemTrace(subCtx, "datasource-model", "hello, world", map[string]interface{}{"foo": 123})
Copy link
Member

Choose a reason for hiding this comment

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

remove commented out lines

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.

5 participants