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

Add optimizer settings to contract build options #82

Merged
merged 1 commit into from
Oct 21, 2024

Conversation

matthew1001
Copy link
Contributor

No description provided.

@peterbroadhurst peterbroadhurst merged commit 33e4774 into v1.1 Oct 21, 2024
1 check passed
@peterbroadhurst peterbroadhurst deleted the contract-optimizer branch October 21, 2024 16:38
@@ -258,6 +274,38 @@ func (r *cms_buildResource) Schema(_ context.Context, _ resource.SchemaRequest,
"commit_hash": &schema.StringAttribute{
Computed: true,
},
"optimizer": &schema.SingleNestedAttribute{
Optional: true,
Computed: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if this is computed ? I guess if you don't provide any settings, it will be ?

And I'm not sure how computed interacts with nested attributes, I'd re-run the Terraform a few times around if you haven't already to ensure these attributes behaves idempotently on re-runs. Additionally, I'd make sure to test contracts that left the optimizer empty as well.

Copy link
Contributor Author

@matthew1001 matthew1001 Oct 22, 2024

Choose a reason for hiding this comment

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

Yeah my terraform know-how isn't great so I'm not sure if computed is correct for the optimizer structure. Here's what I've tested with the current structure:

  1. Apply a plan that has the optimizer section defined. Optimizer options are correctly set on the deployed contract.
  2. Re-plan without any changes. TF doesn't think any changes are required.
  3. Remove the optimizer section. TF thinks it needs to revert the optimizer section to its defaults (i.e. off). Deployed contract correctly has optimization options disabled.
  4. Re-plan without any changes. TF doesn't think any changes are required.

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.

3 participants