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

The data source can be used in cases where deployment topology is split between different teams but there is still a lot of inter-operation between services

As any data source this prevents hardcoding of values, in this case application names, without validation

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    = "ubuntu@22.04"
    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
docs/data-sources/application.md Show resolved Hide resolved
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
@shipperizer shipperizer force-pushed the ds/application branch 2 times, most recently from 20a5e8d to b254b6a Compare December 10, 2024 10:53
internal/provider/data_source_application.go Outdated Show resolved Hide resolved
internal/provider/data_source_application.go Outdated Show resolved Hide resolved
@kian99 kian99 requested review from SimoneDutto and kian99 and removed request for pik4ez-canonical January 10, 2025 09:10
Copy link
Contributor

@kian99 kian99 left a comment

Choose a reason for hiding this comment

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

Can we please update the PR description to explain the use case for this data source and update the documentation to also include the potential use cases.

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.

6 participants